org.xwiki.rendering.block.WordBlock.getChildren()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(1.6k)|赞(0)|评价(0)|浏览(79)

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

WordBlock.getChildren介绍

暂无

代码示例

代码示例来源:origin: org.xwiki.rendering/xwiki-rendering-transformation-wikiword

@Override
  public void transform(Block block, TransformationContext transformationContext) throws TransformationException
  {
    // Find all Word blocks and for each of them check if they're a wiki word or not
    for (WordBlock wordBlock : this.filter.getChildrenByType(block, WordBlock.class, true)) {
      Matcher matcher = WIKIWORD_PATTERN.matcher(wordBlock.getWord());
      if (matcher.matches()) {
        ResourceReference linkReference = new DocumentResourceReference(wordBlock.getWord());
        wordBlock.getParent().replaceChild(new LinkBlock(wordBlock.getChildren(), linkReference, false),
          wordBlock);
      }
    }
  }
}

代码示例来源:origin: org.xwiki.platform/xwiki-core-rendering-transformation-wikiword

/**
   * {@inheritDoc}
   * @see AbstractTransformation#transform(Block, TransformationContext)
   */
  public void transform(Block block, TransformationContext transformationContext) throws TransformationException
  {
    // Find all Word blocks and for each of them check if they're a wiki word or not
    for (WordBlock wordBlock : this.filter.getChildrenByType(block, WordBlock.class, true)) {
      Matcher matcher = WIKIWORD_PATTERN.matcher(wordBlock.getWord());
      if (matcher.matches()) {
        ResourceReference linkReference = new DocumentResourceReference(wordBlock.getWord());
        wordBlock.getParent().replaceChild(new LinkBlock(wordBlock.getChildren(), linkReference, false),
          wordBlock);
      }
    }
  }
}

相关文章

微信公众号

最新文章

更多