当前位置: 首页>>代码示例>>Java>>正文


Java Node.appendChild方法代码示例

本文整理汇总了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"));
}
 
开发者ID:atlassian,项目名称:commonmark-java,代码行数:18,代码来源:YamlFrontMatterTest.java

示例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);
}
 
开发者ID:atlassian,项目名称:commonmark-java,代码行数:17,代码来源:EmphasisDelimiterProcessor.java

示例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);
  }
}
 
开发者ID:jleyba,项目名称:js-dossier,代码行数:27,代码来源:TableBlockParser.java

示例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);
}
 
开发者ID:duyp,项目名称:mvvm-template,代码行数:11,代码来源:EmojiDelimiterProcessor.java

示例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);
}
 
开发者ID:duyp,项目名称:mvvm-template,代码行数:11,代码来源:MentionDelimiterProcessor.java

示例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);
}
 
开发者ID:tidyjava,项目名称:blogging-platform,代码行数:15,代码来源:MarkDelimiterProcessor.java

示例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);
}
 
开发者ID:atlassian,项目名称:commonmark-java,代码行数:15,代码来源:StrikethroughDelimiterProcessor.java

示例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);
}
 
开发者ID:atlassian,项目名称:commonmark-java,代码行数:15,代码来源:InsDelimiterProcessor.java

示例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);
        }
    }
}
 
开发者ID:atlassian,项目名称:commonmark-java,代码行数:39,代码来源:TableBlockParser.java


注:本文中的org.commonmark.node.Node.appendChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。