}
public void renderHTML(ITextConverter converter, Appendable buf, IWikiModel model) throws IOException {
boolean newLinesAfterTag = false;
boolean newLinesAfterChildren = false;
TagNode node = this;
String name = node.getName();
List<Object> children = node.getChildren();
if (children.size() == 0) {
// don't render empty tags (see Issue98)
if (!name.equals("a")) {
// because of section tags allow <a href=\"#Section..." />
return;
}
}
if (NEW_LINES) {
if (name.equals("div") || name.equals("p") || name.equals("li") || name.equals("td")) {
buf.append('\n');
} else if (name.equals("table") || name.equals("ul") || name.equals("ol") || name.equals("th") || name.equals("tr")) {
buf.append('\n');
newLinesAfterTag = true;
newLinesAfterChildren = true;
} else if (name.equals("pre")) {
buf.append('\n');
newLinesAfterTag = false;
newLinesAfterChildren = true;
} else if (name.equals("blockquote")) {
newLinesAfterChildren = true;
}
}
buf.append('<');
buf.append(name);
Map<String, String> tagAtttributes = node.getAttributes();
appendAttributes(buf, tagAtttributes);
if (children.size() == 0) {
buf.append(" />");
} else {
buf.append('>');
if (newLinesAfterTag) {
buf.append('\n');
}
converter.nodesToText(children, buf, model);
if (newLinesAfterChildren) {
buf.append('\n');
}
buf.append("</");
buf.append(node.getName());
buf.append('>');
}
}