Package org.xwiki.rendering.syntax
Interface SyntaxRegistry
@Role
public interface SyntaxRegistry
Register, unregister and list syntaxes available in the wiki. Syntaxes can be automatically registered by
implementing the
javax.inject.Provider<List<Syntax>> component role (and they are automatically unregistered
when the component is unregistered from the Component Manager). If a syntax is registered manually by calling a
register method from this class, then it also needs to be unregistered manually when the extension bringing it is
uninstalled.- Since:
- 13.3RC1
- Version:
- $Id: 288ce1bf7086f5beee047307f111a79a8ac08ef3 $
-
Method Summary
Modifier and TypeMethodDescriptionvoidregisterSyntaxes(Syntax... syntaxes) Adds one or several Syntaxes to the Syntax Registry.resolveSyntax(String syntaxId) Parse the provided string representation of a Syntax and return a typedSyntaxobject.voidunregisterSyntaxes(Syntax... syntaxes) Removes one or several Syntaxes from the Syntax Registry.
-
Method Details
-
registerSyntaxes
Adds one or several Syntaxes to the Syntax Registry.- Parameters:
syntaxes- the syntaxes to add
-
unregisterSyntaxes
Removes one or several Syntaxes from the Syntax Registry.- Parameters:
syntaxes- the syntaxes to remove
-
getSyntaxes
- Returns:
- the list of available Syntaxes
-
getSyntax
- Parameters:
syntaxId- the syntax represented as a string (e.g.xwiki/2.1)- Returns:
- the
Syntaxobject taken from the list of already registered Syntaxes andOptional.empty()if not found
-
resolveSyntax
Parse the provided string representation of a Syntax and return a typedSyntaxobject.- Parameters:
syntaxId- the syntax represented as a string (e.g.xwiki/2.1)- Returns:
- the Syntax from the registry if found and otherwise construct a Syntax object based on the string representation (but with a syntax type name equal to the syntax type id since the information is not present in the string representation).
- Throws:
ParseException- when the passed syntax is invalid
-