Class SyntaxType

java.lang.Object
org.xwiki.rendering.syntax.SyntaxType
All Implemented Interfaces:
Comparable<SyntaxType>

public class SyntaxType extends Object implements Comparable<SyntaxType>
A syntax type is made of three parts:
  • a base syntax type (e.g. xwiki, confluence, mediawiki, etc).
  • zero or more variants, which represent Syntax type variations. For example the markdown syntax has the commonmark variant and the github variant.
  • a human-readable name (e.g. XWiki, Confluence, MediaWiki).
The syntax type string format is: <base type>[+<variant>]*. Examples:
  • xwiki
  • markdown+commonmark
  • sometype+variant1+...+variantN
Since:
2.0RC1
Version:
$Id: 1ca2da469027c460c662725a907f7f98f80141c3 $
  • Field Details

    • XWIKI

      public static final SyntaxType XWIKI
      XWiki wiki syntax.
    • CONFLUENCE

      public static final SyntaxType CONFLUENCE
      Confluence wiki syntax.
    • CONFLUENCEXHTML

      public static final SyntaxType CONFLUENCEXHTML
      Confluence XHTML based syntax.
      Since:
      5.3M1
    • MEDIAWIKI

      public static final SyntaxType MEDIAWIKI
      MediaWiki wiki syntax.
    • DOKUWIKI

      public static final SyntaxType DOKUWIKI
      DokuWiki wiki syntax.
      Since:
      9.8RC1
    • CREOLE

      public static final SyntaxType CREOLE
      Creole wiki syntax.
    • JSPWIKI

      public static final SyntaxType JSPWIKI
      JSPWiki wiki syntax.
    • TWIKI

      public static final SyntaxType TWIKI
      TWiki wiki syntax.
    • XHTML

      public static final SyntaxType XHTML
      XHTML syntax.
    • ANNOTATED_XHTML

      public static final SyntaxType ANNOTATED_XHTML
      Annotated XHTML syntax.
    • ANNOTATED_HTML

      public static final SyntaxType ANNOTATED_HTML
      Annotated HTML syntax.
    • HTML

      public static final SyntaxType HTML
      HTML syntaxes.
    • HTML_FAMILY_TYPES

      public static final Set<SyntaxType> HTML_FAMILY_TYPES
      Syntaxes that are from the HTML family.
      Since:
      13.9RC1
    • PLAIN

      public static final SyntaxType PLAIN
      Plain text syntax.
    • EVENT

      public static final SyntaxType EVENT
      Events syntax.
    • TEX

      public static final SyntaxType TEX
      TEX syntax.
    • DOCBOOK

      public static final SyntaxType DOCBOOK
      DoxBook syntax.
    • XDOMXML

      public static final SyntaxType XDOMXML
      XML based XWiki DOM syntax.
      Since:
      3.3M1
    • MARKDOWN

      public static final SyntaxType MARKDOWN
      MarkDown wiki syntax.
      Since:
      3.4M1
    • APT

      public static final SyntaxType APT
      APT syntax.
      Since:
      4.3M1
  • Constructor Details

    • SyntaxType

      public SyntaxType(String id, String name)
      Parameters:
      id - the technical id of the Syntax type (ex "annotatedxhtml")
      name - the human readable name of the Syntax type (ex "Annotated XHTML")
      Since:
      2.0M3
    • SyntaxType

      public SyntaxType(String id, List<String> variants, String name)
      Parameters:
      id - the technical id of the Syntax type (ex "annotatedxhtml")
      name - the human readable name of the Syntax type (ex "Annotated XHTML")
      variants - the variants (can be empty or null)
      Since:
      13.0, 12.10.1
  • Method Details

    • getSyntaxTypes

      @Deprecated public static Map<String,SyntaxType> getSyntaxTypes()
      Deprecated.
      since 13.3RC1, use SyntaxRegistry.getSyntaxes()
      Returns:
      the well-known Syntax types
    • getId

      public String getId()
      Returns:
      the technical id of the Syntax type (ex "annotatedxhtml")
      Since:
      2.0M3
    • getVariants

      public List<String> getVariants()
      Returns:
      the variants (can never be null but can be empty)
      Since:
      13.0, 12.10.1
    • getName

      public String getName()
      Returns:
      the human readable name of the Syntax type (ex "Annotated XHTML")
      Since:
      2.0M3
    • toIdString

      public String toIdString()
      Returns:
      a unique String identifier, does not contain the display name. Usable when searching for parsers and renderers components for example.
      Since:
      13.0, 12.10.1
    • toString

      public String toString()

      Display a human readable name of the Syntax type.

      Overrides:
      toString in class Object
      See Also:
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • compareTo

      public int compareTo(SyntaxType syntaxType)
      Specified by:
      compareTo in interface Comparable<SyntaxType>
    • valueOf

      public static SyntaxType valueOf(String syntaxTypesString) throws ParseException
      Parameters:
      syntaxTypesString - the syntax type as a string (eg xwiki, confluence+xhtml)
      Returns:
      the parsed syntax type as a SyntaxType object
      Throws:
      ParseException - in case the string doesn't represent a valid syntax type
      Since:
      13.0, 12.10.1