html method
Implementation
String html(List<Tag>? tags) {
String res = '';
if (tags != null && tags.isNotEmpty) {
for (final tag in tags) {
if (tag.type == typeTag) {
res += '<${tag.name}';
// attrs
final attrs = tag.attributes;
if (attrs.isNotEmpty) {
attrs.forEach((name, attr) {
res += ' ${attr.name}="${attr.value}"';
});
}
res += '>';
// childs
final childs = tag.childs;
if (childs.isNotEmpty) {
res += html(childs);
}
//end
res += '</${tag.name}>';
} else {
res += tag.body != null ? tag.body! : '';
}
}
}
return res;
}