use of org.commonmark.node.HardLineBreak in project gitiles by GerritCodeReview.
the class GitilesHtmlExtension method inline.
private static void inline(HtmlInline curr) {
String html = curr.getLiteral();
Matcher m = BREAK.matcher(html);
if (m.matches()) {
switch(m.group(1).toLowerCase()) {
case "br":
curr.insertAfter(new HardLineBreak());
curr.unlink();
return;
case "hr":
curr.insertAfter(new ThematicBreak());
curr.unlink();
return;
}
}
m = ANCHOR_OPEN.matcher(html);
if (m.matches()) {
String name = m.group(2);
Node next = curr.getNext();
// HtmlInline{<a name="id">}HtmlInline{</a>}
if (isAnchorClose(next)) {
next.unlink();
NamedAnchor anchor = new NamedAnchor();
anchor.setName(name);
curr.insertAfter(anchor);
curr.unlink();
MarkdownUtil.trimPreviousWhitespace(anchor);
return;
}
}
}
Aggregations