org.xwiki.rendering.parser.Parser.getSyntax()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(2.1k)|赞(0)|评价(0)|浏览(121)

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

Parser.getSyntax介绍

暂无

代码示例

代码示例来源:origin: org.xwiki.platform/xwiki-platform-rendering-configuration-default

/**
   * @return the list of syntaxes for which a Parser is available
   */
  public List<Syntax> getAvailableParserSyntaxes()
  {
    List<Syntax> syntaxes = new ArrayList<>();
    try {
      for (Parser parser : this.componentManagerProvider.get().<Parser>getInstanceList(Parser.class)) {
        syntaxes.add(parser.getSyntax());
      }
    } catch (ComponentLookupException e) {
      // This shouldn't happen; if it does then it's critical
      throw new RuntimeException("Failed to lookup parsers", e);
    }

    return syntaxes;
  }
}

代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core

/**
 * Gets all syntaxes supported by the rendering parsers as an input for a syntax conversion.
 * 
 * @param token The authentication token.
 * @return A list containing all syntaxes supported by rendering parsers.
 * @throws Exception An invalid token is provided or the syntax lookup fails.
 */
public List<String> getInputSyntaxes(String token) throws Exception
{
  XWikiXmlRpcUser user = XWikiUtils.checkToken(token, this.xwikiContext);
  List<String> syntaxes = new ArrayList<String>();
  List<Parser> parsers;
  ComponentManager componentManager = Utils.getComponentManager();
  try {
    parsers = componentManager.lookupList(Parser.class);
    for (Parser parser : parsers) {
      syntaxes.add(parser.getSyntax().toIdString());
    }
  } catch (ComponentLookupException e) {
    throw new RuntimeException("Failed to lookup the list of available parser syntaxes", e);
  }
  return syntaxes;
}

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

private org.xwiki.rendering.syntax.Syntax getInputSyntax(String inputSyntaxId, String outputSyntaxId)
  throws Exception
{
  org.xwiki.rendering.syntax.Syntax syntax;
  if (isStreamingTest(inputSyntaxId, outputSyntaxId)) {
    StreamParser parser = getComponentManager().getInstance(StreamParser.class, inputSyntaxId);
    syntax = parser.getSyntax();
  } else {
    Parser parser = getComponentManager().getInstance(Parser.class, inputSyntaxId);
    syntax = parser.getSyntax();
  }
  return syntax;
}

相关文章