org.pegdown.ast.Node.getStartIndex()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(99)

本文整理了Java中org.pegdown.ast.Node.getStartIndex()方法的一些代码示例,展示了Node.getStartIndex()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.getStartIndex()方法的具体详情如下:
包路径:org.pegdown.ast.Node
类名称:Node
方法名:getStartIndex

Node.getStartIndex介绍

暂无

代码示例

代码示例来源:origin: org.pegdown/pegdown

public void collectChildrensText(SuperNode node, AnchorNodeInfo nodeInfo) {
  for (Node child : node.getChildren()) {
    // accumulate all the text
    if (child.getClass() == TextNode.class || child.getClass() == SpecialTextNode.class) {
      nodeInfo.text.append(((TextNode) child).getText());
      if (nodeInfo.startIndex == 0) {
        nodeInfo.startIndex = child.getStartIndex();
      }
      nodeInfo.endIndex = child.getEndIndex();
    } else if (child instanceof SuperNode) {
      collectChildrensText((SuperNode) child, nodeInfo);
    }
  }
}

代码示例来源:origin: org.pegdown/pegdown

boolean setListItemIndices() {
  SuperNode listItem = (SuperNode) getContext().getValueStack().peek();
  List<Node> children = listItem.getChildren();
  listItem.setStartIndex(children.get(0).getStartIndex());
  listItem.setEndIndex(children.get(children.size() - 1).getEndIndex());
  return true;
}

代码示例来源:origin: org.pegdown/pegdown

public boolean wrapInAnchor() {
  if (ext(ANCHORLINKS | EXTANCHORLINKS)) {
    SuperNode node = (SuperNode) peek();
    List<Node> children = node.getChildren();
    if (ext(EXTANCHORLINKS)) {
      if (children.size() > 0) {
        AnchorNodeInfo nodeInfo = new AnchorNodeInfo();
        collectChildrensText(node, nodeInfo);
        String text = nodeInfo.text.toString().trim();
        if (text.length() > 0) {
          AnchorLinkNode anchor = new AnchorLinkNode(text, "");
          anchor.setStartIndex(nodeInfo.startIndex);
          anchor.setEndIndex(nodeInfo.endIndex);
          children.add(0, anchor);
        }
      }
    } else {
      if (children.size() == 1) {
        Node child = children.get(0);
        if (child instanceof TextNode) {
          AnchorLinkNode anchor = new AnchorLinkNode(((TextNode) child).getText());
          anchor.setStartIndex(child.getStartIndex());
          anchor.setEndIndex(child.getEndIndex());
          children.set(0, anchor);
        }
      }
    }
  }
  return true;
}

代码示例来源:origin: org.pegdown/pegdown

boolean wrapFirstItemInPara(SuperNode item) {
  Node firstItemFirstChild = item.getChildren().get(0);
  ParaNode paraNode = new ParaNode(firstItemFirstChild.getChildren());
  paraNode.setStartIndex(firstItemFirstChild.getStartIndex());
  paraNode.setEndIndex(firstItemFirstChild.getEndIndex());
  // vsch: wrap the para in RootNode so that it is identical to the rest of the list items if they are loose, otherwise it creates differences in html serialization of task items
  RootNode rootNode = new RootNode();
  rootNode.setStartIndex(paraNode.getStartIndex());
  rootNode.setEndIndex(paraNode.getEndIndex());
  rootNode.getChildren().add(paraNode);
  item.getChildren().set(0, rootNode);
  return true;
}

代码示例来源:origin: bsorrentino/maven-confluence-plugin

int col = 0;
int offset = node.getStartIndex();

代码示例来源:origin: gradle.plugin.com.github.qwazer/markdown-confluence-gradle-plugin

int col = 0;
int offset = node.getStartIndex();

代码示例来源:origin: org.bsc.maven/maven-confluence-core

int col = 0;
int offset = node.getStartIndex();

相关文章

微信公众号

最新文章

更多