本文整理汇总了Java中org.commonmark.node.Node.appendChild方法的典型用法代码示例。如果您正苦于以下问题:Java Node.appendChild方法的具体用法?Java Node.appendChild怎么用?Java Node.appendChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.commonmark.node.Node
的用法示例。
在下文中一共展示了Node.appendChild方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitorIgnoresOtherCustomNodes
import org.commonmark.node.Node; //导入方法依赖的package包/类
@Test
public void visitorIgnoresOtherCustomNodes() {
final String input = "---" +
"\nhello: world" +
"\n---" +
"\n";
YamlFrontMatterVisitor visitor = new YamlFrontMatterVisitor();
Node document = PARSER.parse(input);
document.appendChild(new TestNode());
document.accept(visitor);
Map<String, List<String>> data = visitor.getData();
assertEquals(1, data.size());
assertTrue(data.containsKey("hello"));
assertEquals(Collections.singletonList("world"), data.get("hello"));
}
示例2: process
import org.commonmark.node.Node; //导入方法依赖的package包/类
@Override
public void process(Text opener, Text closer, int delimiterUse) {
String singleDelimiter = String.valueOf(getOpeningCharacter());
Node emphasis = delimiterUse == 1
? new Emphasis(singleDelimiter)
: new StrongEmphasis(singleDelimiter + singleDelimiter);
Node tmp = opener.getNext();
while (tmp != null && tmp != closer) {
Node next = tmp.getNext();
emphasis.appendChild(tmp);
tmp = next;
}
opener.insertAfter(emphasis);
}
示例3: parseInlines
import org.commonmark.node.Node; //导入方法依赖的package包/类
@Override
public void parseInlines(InlineParser inlineParser) {
Node headNode = new TableHeadNode();
block.appendChild(headNode);
headNode.appendChild(parseRow(headerRow.toString(), inlineParser));
// The first row of data is always the column alignments, which we've already parsed.
Node bodyNode = new TableBodyNode();
block.appendChild(bodyNode);
String caption = null;
for (CharSequence line : Iterables.skip(rowData, 1)) {
Matcher captionMatcher = CAPTION_LINE.matcher(line);
if (captionMatcher.matches()) {
caption = captionMatcher.group("content").trim();
} else {
TableRowNode row = parseRow(line.toString(), inlineParser);
bodyNode.appendChild(row);
}
}
if (!isNullOrEmpty(caption)) {
TableCaptionNode captionNode = new TableCaptionNode();
headNode.insertBefore(captionNode);
inlineParser.parse(caption.trim(), captionNode);
}
}
示例4: process
import org.commonmark.node.Node; //导入方法依赖的package包/类
@Override public void process(Text opener, Text closer, int delimiterCount) {
Node emoji = new Emoji();
Node tmp = opener.getNext();
while (tmp != null && tmp != closer) {
Node next = tmp.getNext();
emoji.appendChild(tmp);
tmp = next;
}
opener.insertAfter(emoji);
}
示例5: process
import org.commonmark.node.Node; //导入方法依赖的package包/类
@Override public void process(Text opener, Text closer, int delimiterCount) {
Node mention = new Mention();
Node tmp = opener.getNext();
while (tmp != null && tmp != closer) {
Node next = tmp.getNext();
mention.appendChild(tmp);
tmp = next;
}
opener.insertAfter(mention);
}
示例6: process
import org.commonmark.node.Node; //导入方法依赖的package包/类
@Override
public void process(Text opener, Text closer, int delimiterCount) {
// Wrap nodes between delimiters in marks.
Node marks = new Mark();
Node tmp = opener.getNext();
while (tmp != null && tmp != closer) {
Node next = tmp.getNext();
marks.appendChild(tmp);
tmp = next;
}
opener.insertAfter(marks);
}
示例7: process
import org.commonmark.node.Node; //导入方法依赖的package包/类
@Override
public void process(Text opener, Text closer, int delimiterCount) {
// Wrap nodes between delimiters in strikethrough.
Node strikethrough = new Strikethrough();
Node tmp = opener.getNext();
while (tmp != null && tmp != closer) {
Node next = tmp.getNext();
strikethrough.appendChild(tmp);
tmp = next;
}
opener.insertAfter(strikethrough);
}
示例8: process
import org.commonmark.node.Node; //导入方法依赖的package包/类
@Override
public void process(Text opener, Text closer, int delimiterCount) {
// Wrap nodes between delimiters in ins.
Node ins = new Ins();
Node tmp = opener.getNext();
while (tmp != null && tmp != closer) {
Node next = tmp.getNext();
ins.appendChild(tmp);
tmp = next;
}
opener.insertAfter(ins);
}
示例9: parseInlines
import org.commonmark.node.Node; //导入方法依赖的package包/类
@Override
public void parseInlines(InlineParser inlineParser) {
Node section = new TableHead();
block.appendChild(section);
List<TableCell.Alignment> alignments = parseAlignment(separatorLine);
int headerColumns = -1;
boolean header = true;
for (CharSequence rowLine : rowLines) {
List<String> cells = split(rowLine);
TableRow tableRow = new TableRow();
if (headerColumns == -1) {
headerColumns = cells.size();
}
// Body can not have more columns than head
for (int i = 0; i < headerColumns; i++) {
String cell = i < cells.size() ? cells.get(i) : "";
TableCell.Alignment alignment = i < alignments.size() ? alignments.get(i) : null;
TableCell tableCell = new TableCell();
tableCell.setHeader(header);
tableCell.setAlignment(alignment);
inlineParser.parse(cell.trim(), tableCell);
tableRow.appendChild(tableCell);
}
section.appendChild(tableRow);
if (header) {
// Format allows only one row in head
header = false;
section = new TableBody();
block.appendChild(section);
}
}
}