Class Syntax

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

public class Syntax extends Object implements Comparable<Syntax>
Represents a wiki syntax that the user can use to enter wiki content. A syntax is made of three parts:
  • a syntax type (e.g. xwiki, confluence, confluence+xhtml, etc).
  • a version (1.0, 2.0, etc.
  • an optional qualifier which is a free form string adding some additional information about the Syntax when serialized as a String). Can be used for example to mark a Syntax as experimental.
The syntax id string format is: <type>/<version>. Examples:
  • xwiki/2.1
  • markdown+commonmark/1.2
  • sometype+variant1+...+variantN/1.0
Since:
2.0RC1
Version:
$Id: 08fcdbb4884bee932d1fabaca8be39b8acab4550 $
  • Field Details

    • XHTML_5

      public static final Syntax XHTML_5
      XHTML5 syntax.
      Since:
      14.1RC1
    • HTML_5_0

      public static final Syntax HTML_5_0
      HTML5 syntax.
      Since:
      6.4M3
    • XHTML_1_0

      public static final Syntax XHTML_1_0
      XHTML 1.0 syntax.
    • HTML_4_01

      public static final Syntax HTML_4_01
      HTML 4.01 syntax.
    • XWIKI_1_0

      @Deprecated(since="5.0") public static final Syntax XWIKI_1_0
      Deprecated.
      use XWIKI_2_1 instead
      XWiki 1.0 syntax.
    • XWIKI_2_0

      public static final Syntax XWIKI_2_0
      XWiki 2.0 syntax.
    • XWIKI_2_1

      public static final Syntax XWIKI_2_1
      XWiki 2.1 syntax.
    • PLAIN_1_0

      public static final Syntax PLAIN_1_0
      Plain text syntax.
    • EVENT_1_0

      public static final Syntax EVENT_1_0
      Events syntax.
    • TEX_1_0

      public static final Syntax TEX_1_0
      TEX syntax.
    • CREOLE_1_0

      public static final Syntax CREOLE_1_0
      Creole syntax.
    • JSPWIKI_1_0

      public static final Syntax JSPWIKI_1_0
      JSPWiki syntax.
    • MEDIAWIKI_1_0

      @Deprecated(since="8.2RC1") public static final Syntax MEDIAWIKI_1_0
      Deprecated.
      use MEDIAWIKI_1_6 instead
      Old MediaWiki syntax.
    • MEDIAWIKI_1_6

      public static final Syntax MEDIAWIKI_1_6
      New MediaWiki syntax.
    • DOKUWIKI_1_0

      public static final Syntax DOKUWIKI_1_0
      DokuWiki syntax.
      Since:
      9.8RC1
    • TWIKI_1_0

      public static final Syntax TWIKI_1_0
      TWiki syntax.
    • DOCBOOK_4_4

      public static final Syntax DOCBOOK_4_4
      Docbook 4.4 syntax.
    • CONFLUENCE_1_0

      public static final Syntax CONFLUENCE_1_0
      Confluence wiki syntax.
    • CONFLUENCEXHTML_1_0

      public static final Syntax CONFLUENCEXHTML_1_0
      Confluence XHTML based syntax.
      Since:
      5.3M1
    • XDOMXML_CURRENT

      public static final Syntax XDOMXML_CURRENT
      Since:
      3.3M1
    • XDOMXML_1_0

      public static final Syntax XDOMXML_1_0
      Since:
      3.3M1
    • MARKDOWN_1_0

      public static final Syntax MARKDOWN_1_0
      Since:
      3.4M1
    • MARKDOWN_1_1

      public static final Syntax MARKDOWN_1_1
      Since:
      5.2M1
    • APT_1_0

      public static final Syntax APT_1_0
      Since:
      4.3M1
    • ANNOTATED_XHTML_1_0

      public static final Syntax ANNOTATED_XHTML_1_0
      This is HTML with annotations (comments) in order to allow round tripping between for example the WYSIWYG editor and wiki syntax.
    • ANNOTATED_HTML_5_0

      public static final Syntax ANNOTATED_HTML_5_0
      This is HTML5 with annotations (comments) in order to allow round tripping between for example the WYSIWYG editor and wiki syntax.
  • Constructor Details

    • Syntax

      public Syntax(SyntaxType type, String version)
      Parameters:
      type - the type of the syntax
      version - the specific version of the syntax
    • Syntax

      public Syntax(SyntaxType type, String version, String qualifier)
      Parameters:
      type - the type of the syntax
      version - the specific version of the syntax
      qualifier - a qualifier
  • Method Details

    • valueOf

      @Deprecated(since="13.3RC1") public static Syntax valueOf(String syntaxIdAsString) throws ParseException
      Parameters:
      syntaxIdAsString - the syntax as a string (eg "xwiki/2.0", "plain/1.0")
      Returns:
      the parsed syntax as a Syntax object
      Throws:
      ParseException - in case the string doesn't represent a valid syntax
      Since:
      9.8RC1
    • getType

      public SyntaxType getType()
      Returns:
      the type of the syntax
    • getVersion

      public String getVersion()
      Returns:
      the specific version of the syntax
    • getQualifier

      public String getQualifier()
      Returns:
      a qualifier
    • toIdString

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

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

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

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

      public int compareTo(Syntax syntax)
      Specified by:
      compareTo in interface Comparable<Syntax>