in log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/processor/AbstractAsciiDocTreeVisitor.java [65:132]
public Void visitStartElement(final StartElementTree node, final AsciiDocData data) {
final String elementName = node.getName().toString();
switch (elementName) {
case "p":
data.newParagraph();
break;
case "ol":
// Nested list without a first paragraph
if (data.getCurrentNode() instanceof ListItem) {
data.newParagraph();
}
data.pushChildNode(ListImpl::new).setContext(ListImpl.ORDERED_LIST_CONTEXT);
break;
case "ul":
// Nested list without a first paragraph
if (data.getCurrentNode() instanceof ListItem) {
data.newParagraph();
}
data.pushChildNode(ListImpl::new).setContext(ListImpl.UNORDERED_LIST_CONTEXT);
break;
case "li":
if (!(data.getCurrentNode() instanceof List)) {
throw new IllegalArgumentException("A <li> tag must be a child of a <ol> or <ul> tag.");
}
data.pushChildNode(ListItemImpl::new);
break;
case "h1":
case "h2":
case "h3":
case "h4":
case "h5":
case "h6":
// Flush the current paragraph
data.newParagraph();
StructuralNode currentNode;
// Remove other types of nodes from stack
while ((currentNode = data.getCurrentNode()) != null
&& !(currentNode instanceof Section || currentNode instanceof Document)) {
data.popNode();
}
break;
case "table":
data.pushChildNode(TableImpl::new);
break;
case "tr":
break;
case "th":
data.pushChildNode(CellImpl::new).setContext(CellImpl.HEADER_CONTEXT);
break;
case "td":
data.pushChildNode(CellImpl::new);
break;
case "pre":
data.newParagraph();
data.getCurrentParagraph().setContext(BlockImpl.LISTING_CONTEXT);
break;
case "code":
case "em":
case "i":
case "strong":
case "b":
case "caption":
data.newTextSpan();
break;
default:
}
return super.visitStartElement(node, data);
}