org.xwiki.rendering.syntax.Syntax.toIdString()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(118)

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

Syntax.toIdString介绍

暂无

代码示例

代码示例来源:origin: org.xwiki.platform/xwiki-platform-filter-stream-xar

public String toString(Syntax syntax)
{
  return syntax != null ? syntax.toIdString() : null;
}

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

/**
 * @return true if the document has a xwiki/1.0 syntax content
 */
public boolean is10Syntax(String syntaxId)
{
  return Syntax.XWIKI_1_0.toIdString().equalsIgnoreCase(syntaxId);
}

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

/**
 * @param text the text to render
 * @param syntaxId the id of the Syntax used by the passed text (for example: "xwiki/1.0")
 * @param context the XWiki Context object
 * @return the given text rendered in the context of this document using the passed Syntax
 * @since 1.6M1
 */
public String getRenderedContent(String text, String syntaxId, XWikiContext context)
{
  return getRenderedContent(text, syntaxId, Syntax.XHTML_1_0.toIdString(), context);
}

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

/**
 * @deprecated starting with XE 1.8.1 use
 *             {@link #createUser(String, Map, String, String, String, String, XWikiContext)} instead
 */
@Deprecated
public int createUser(String xwikiname, Map map, String parent, String content, String userRights,
  XWikiContext context) throws XWikiException
{
  return createUser(xwikiname, map, parent, content, Syntax.XWIKI_1_0.toIdString(), userRights, context);
}

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

/**
 * {@inheritDoc}
 * <p>
 * Note that this method cannot be removed for now since it's used by Hibernate for saving a XWikiDocument.
 * 
 * @see org.xwiki.bridge.DocumentModelBridge#getSyntaxId()
 * @deprecated since 2.3M1, use {link #getSyntax()} instead
 */
@Deprecated
public String getSyntaxId()
{
  return getSyntax().toIdString();
}

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

private Syntax getDefaultDocumentSyntax()
{
  // If there's no parser available for the specified syntax default to XWiki 2.0 syntax
  Syntax syntax = Utils.getComponent(CoreConfiguration.class).getDefaultDocumentSyntax();
  try {
    Utils.getComponent(Parser.class, syntax.toIdString());
  } catch (Exception e) {
    LOG.warn("Failed to find parser for the default syntax [" + syntax.toIdString()
      + "]. Defaulting to xwiki/2.0 syntax.");
    syntax = Syntax.XWIKI_2_0;
  }
  return syntax;
}

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

/**
 * @param text the text to render
 * @return the given text rendered in the context of this document
 * @deprecated since 1.6M1 use {@link #getRenderedContent(String, String)}
 */
@Deprecated
public String getRenderedContent(String text) throws XWikiException
{
  return this.doc.getRenderedContent(text, Syntax.XWIKI_1_0.toIdString(), getXWikiContext());
}

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

@Override
public void onRawText(String text, Syntax syntax)
{
  getPrinter().println("onRawText [" + text + "] [" + syntax.toIdString() + "]");
}

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

/**
 * @return the syntax id of the syntax to use when creating new documents.
 */
public String getDefaultDocumentSyntax()
{
  // TODO: Fix this method to return a Syntax object instead of a String
  return Utils.getComponent(CoreConfiguration.class).getDefaultDocumentSyntax().toIdString();
}

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

/**
 * {@inheritDoc}
 * 
 * @see org.xwiki.rendering.renderer.AbstractChainingPrintRenderer#onRawText(String, Syntax)
 */
@Override
public void onRawText(String text, Syntax syntax)
{
  getPrinter().println("onRawText [" + text + "] [" + syntax.toIdString() + "]");
}

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

/**
 * Get the parser for the current syntax.
 *
 * @param syntax the current syntax of the title content
 * @return the parser for the current syntax
 * @throws org.xwiki.rendering.macro.MacroExecutionException Failed to find source parser.
 */
private Parser getSyntaxParser(Syntax syntax) throws MacroExecutionException
{
  try {
    return this.componentManager.getInstance(Parser.class, syntax.toIdString());
  } catch (ComponentLookupException e) {
    throw new MacroExecutionException("Failed to find source parser for syntax [" + syntax + "]", e);
  }
}

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

/**
   * Get the parser for the current syntax.
   *
   * @param syntax the current syntax of the title content
   * @return the parser for the current syntax
   * @throws org.xwiki.rendering.macro.MacroExecutionException Failed to find source parser.
   */
  private Parser getSyntaxParser(Syntax syntax) throws MacroExecutionException
  {
    try {
      return this.componentManager.lookup(Parser.class, syntax.toIdString());
    } catch (ComponentLookupException e) {
      throw new MacroExecutionException("Failed to find source parser for syntax [" + syntax + "]", e);
    }
  }
}

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

@Override
public String toString()
{
  return getId() + ((getSyntax() == null) ? "" : "/" + getSyntax().toIdString());
}

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

/**
 * {@inheritDoc}
 *
 * @see Object#toString()
 */
@Override
public String toString()
{
  return getId() + ((getSyntax() == null) ? "" : "/" + getSyntax().toIdString());
}

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

public String displayRendered(PropertyClass pclass, String prefix, BaseCollection object, XWikiContext context)
  throws XWikiException
{
  String result = pclass.displayView(pclass.getName(), prefix, object, context);
  return getRenderedContent(result, Syntax.XWIKI_1_0.toIdString(), context);
}

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

private String getCurrentContentSyntaxIdInternal(XWikiContext context)
{
  String syntaxId = null;
  if (context.get("sdoc") != null) {
    // The content document
    syntaxId = ((XWikiDocument) context.get("sdoc")).getSyntax().toIdString();
  } else if (context.getDoc() != null) {
    // The context document
    syntaxId = context.getDoc().getSyntax().toIdString();
  }
  return syntaxId;
}

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

/**
 * @return the {@link StreamParser} to use to parser the input content
 */
protected StreamParser getStreamParser()
{
  StreamParser streamParser;
  try {
    streamParser = this.componentManager.lookup(StreamParser.class, getSyntax().toIdString());
  } catch (ComponentLookupException e) {
    throw new RuntimeException("Failed to create [" + getSyntax().toString() + "] renderer", e);
  }
  return streamParser;
}

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

/**
   * {@inheritDoc}
   * 
   * @see PrintRendererFactory#createRenderer(org.xwiki.rendering.renderer.printer.WikiPrinter)
   */
  public PrintRenderer createRenderer(WikiPrinter printer)
  {
    PrintRenderer renderer;
    try {
      renderer = this.componentManager.lookup(PrintRenderer.class, getSyntax().toIdString());
    } catch (ComponentLookupException e) {
      throw new RuntimeException("Failed to create [" + getSyntax().toString() + "] renderer", e);
    }

    renderer.setPrinter(printer);

    return renderer;
  }
}

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

@Override
public List<Block> execute(ContentMacroParameters parameters, String content, MacroTransformationContext context)
  throws MacroExecutionException
{
  try {
    List<Block> blocks = getSyntaxParser(parameters.getSyntax()).parse(new StringReader(content)).getChildren();
    MetaDataBlock metaDataBlock = new MetaDataBlock(blocks, MetaData.SYNTAX,
      parameters.getSyntax().toIdString());
    metaDataBlock.getMetaData().addMetaData(this.getNonGeneratedContentMetaData());
    return Collections.singletonList(metaDataBlock);
  } catch (ParseException e) {
    throw new MacroExecutionException(
      String.format("Failed to parse macro content in syntax [%s]", parameters.getSyntax()), e);
  }
}

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

@Override
protected String render() throws EditException
{
  try {
    XWikiContext xcontext = this.xcontextProvider.get();
    XWikiDocument editorDocument = xcontext.getWiki().getDocument(this.getDocumentReference(), xcontext);
    BaseObject editorObject = editorDocument.getXObject(EDITOR_CLASS_REFERENCE);
    String editorCode = editorObject.getStringValue("code");
    // Make sure the editor code is executed with the rights of the editor document author.
    XWikiDocument sdoc = editorDocument;
    // Execute the editor code in the context of the current document (because the editor code needs to access
    // the data that has been put on the script context).
    return xcontext.getDoc().getRenderedContent(editorCode, editorDocument.getSyntax().toIdString(), false,
      sdoc, xcontext);
  } catch (Exception e) {
    throw new EditException("Failed to render the editor code.", e);
  }
}

相关文章