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

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

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

Block.getFirstBlock介绍

暂无

代码示例

代码示例来源:origin: org.xwiki.rendering/xwiki-rendering-macro-footnotes

@Override
  public List<Block> execute(FootnoteMacroParameters parameters, String content, MacroTransformationContext context)
    throws MacroExecutionException
  {
    Block root = context.getXDOM();

    Block matchingBlock = root.getFirstBlock(MACRO_BLOCK_MATCHER, Block.Axes.DESCENDANT);
    if (matchingBlock != null) {
      return Collections.emptyList();
    }

    Block putFootnotesMacro =
      new MacroBlock(PutFootnotesMacro.MACRO_NAME, Collections.<String, String>emptyMap(), false);
    root.addChild(putFootnotesMacro);

    return Collections.emptyList();
  }
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-rendering-macro-script

/**
   * @param source the blocks from where to try to extract the source content
   * @return the source content reference or null if none is found
   */
  private String extractSourceContentReference(Block source)
  {
    String contentSource = null;
    MetaDataBlock metaDataBlock =
      source.getFirstBlock(new MetadataBlockMatcher(MetaData.SOURCE), Block.Axes.ANCESTOR);
    if (metaDataBlock != null) {
      contentSource = (String) metaDataBlock.getMetaData().getMetaData(MetaData.SOURCE);
    }
    return contentSource;
  }
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-chart-macro

/**
   * @param source the blocks from where to try to extract the source content
   * @return the source content reference or null if none is found
   */
  private String extractSourceContentReference(Block source)
  {
    String contentSource = null;
    MetaDataBlock metaDataBlock =
      source.getFirstBlock(new MetadataBlockMatcher(MetaData.SOURCE), Block.Axes.ANCESTOR);
    if (metaDataBlock != null) {
      contentSource = (String) metaDataBlock.getMetaData().getMetaData(MetaData.SOURCE);
    }
    return contentSource;
  }
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-office-viewer

private void maybeFixExpandedMacroAncestor(Block block)
{
  ExpandedMacroBlock expandedMacro =
    block.getFirstBlock(new ClassBlockMatcher(ExpandedMacroBlock.class), Block.Axes.ANCESTOR_OR_SELF);
  if (expandedMacro != null) {
    Block parent = expandedMacro.getParent();
    if (!(parent instanceof MetaDataBlock) || !((MetaDataBlock) parent).getMetaData().contains(MODULE_NAME)) {
      MetaDataBlock metaData = new MetaDataBlock(Collections.<Block>emptyList());
      // Use a syntax that supports relative path resource references (we use relative paths to include the
      // temporary files).
      metaData.getMetaData().addMetaData(MetaData.SYNTAX, Syntax.XWIKI_2_1);
      metaData.getMetaData().addMetaData(MODULE_NAME, true);
      parent.replaceChild(metaData, expandedMacro);
      metaData.addChild(expandedMacro);
    }
  }
}

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

rootBlock.getFirstBlock(priorityMacroBlockMatcher, Block.Axes.DESCENDANT);

相关文章