trait TransformerBuilderOps[FMT] extends ParserBuilderOps with RendererBuilderOps[FMT]
API for specifying configuration options that apply to all kinds of operations that contain both, a parsing and a rendering step (only Transform API).
- Alphabetic
- By Inheritance
- TransformerBuilderOps
- RendererBuilderOps
- ParserBuilderOps
- CommonBuilderOps
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
abstract
type
ThisType
The type of the operation being configured by this instance.
The type of the operation being configured by this instance.
- Definition Classes
- CommonBuilderOps
Abstract Value Members
-
abstract
def
config: OperationConfig
The current configuration for this instance.
The current configuration for this instance.
- Attributes
- protected
- Definition Classes
- CommonBuilderOps
-
abstract
def
renderFormat: RenderFormat[FMT]
- Attributes
- protected
- Definition Classes
- RendererBuilderOps
-
abstract
def
withConfig(newConfig: OperationConfig): ThisType
Returns a new instance with the specified configuration.
Returns a new instance with the specified configuration.
This method discards any previously specified options. It is usually meant to be used when copying over the configuration from a fully configured object to an unconfigured one.
- Definition Classes
- CommonBuilderOps
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
buildingRule(newRules: RewriteRulesBuilder): ThisType
Specifies a rewrite rule to be applied to the document tree model between the parse and render operations.
Specifies a rewrite rule to be applied to the document tree model between the parse and render operations. This is identical to calling
Document.rewrite
directly, but if there is no need to otherwise access the document instance and just chain parse and render operations this hook is more convenient.The difference of this method to the
usingRules
method is that it expects a function that takes aDocumentCursor
instance and returns the rewrite rules. This way the full document can be queried before any rule is applied. This is necessary in cases where the rule (which gets applied node-by-node) depends on information from other nodes. An example from the built-in rewrite rules is the rule that resolves link references. To replace all link reference elements with actual link elements, the rewrite rule needs to know all LinkDefinitions the document tree contains.The builder function returns an
Either[ConfigError, RewriteRules]
which allows for validation of document configuration before creating the rule.The rules themselves are partial functions of type
PartialFunction[T, RewriteRule[T]]
whereT
is eitherSpan
,Block
orTemplateSpan
, the 3 main categories of element types that support rewriting.If the partial function is not defined for a specific element or the rule returns a
Retain
action as a result the old block remains in the tree unchanged.If it returns
Remove
then the element gets removed from the ast, if it returnsReplace
with a new element it will replace the old one.The rewriting is performed bottom-up (depth-first), therefore any element container passed to the rule only contains children which have already been processed.
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
failOnMessages(filter: MessageFilter): ThisType
Specifies the filter to apply to runtime messages that should cause a transformation to fail.
Specifies the filter to apply to runtime messages that should cause a transformation to fail.
The default is to fail transformations on messages of level
Error
or higher.- Definition Classes
- ParserBuilderOps
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
renderMessages(filter: MessageFilter): ThisType
Specifies the minimum required level for a runtime message to get included into the output by this renderer.
Specifies the minimum required level for a runtime message to get included into the output by this renderer.
- Definition Classes
- RendererBuilderOps
-
def
rendering(customRenderer: PartialFunction[(FMT, Element), String]): ThisType
Specifies a custom render function that overrides one or more of the default renderers for the output format this instance uses.
Specifies a custom render function that overrides one or more of the default renderers for the output format this instance uses.
This method expects a partial function that takes a formatter and the element to render. It will then be invoked for each element it is defined at.
Simple example for customizing the HTML output for emphasized text, adding a specific style class:
val transformer = Transformer.from(Markdown).to(HTML).rendering { case (fmt, Emphasized(content, opt)) => fmt.element("em", opt, content, "class" -> "big") }.build
- Definition Classes
- RendererBuilderOps
-
def
strict: ThisType
Turns strict mode on for the target parser, switching off any features not part of the original markup syntax.
Turns strict mode on for the target parser, switching off any features not part of the original markup syntax. This includes the registration of directives (custom tags), custom templates with directives, as well as configuration sections at the start of the document.
Technically it removes all
ExtensionBundle
instances which do not have theuseInStrictMode
flag set to true.- Definition Classes
- ParserBuilderOps
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
unformatted: ThisType
Renders without any formatting (line breaks or indentation).
Renders without any formatting (line breaks or indentation). Useful when storing the output in a database for example.
- Definition Classes
- RendererBuilderOps
-
def
using(bundles: ExtensionBundle*): ThisType
Returns a new instance with the specified extension bundles installed.
Returns a new instance with the specified extension bundles installed. Features in the new bundles may override features in already installed bundles.
Bundles are usually provided by libraries (by Laika itself or a 3rd-party extension library) or as re-usable building blocks by application code.
- Definition Classes
- CommonBuilderOps
-
def
usingBlockRule(rule: RewriteRule[Block]): ThisType
Specifies a single block rewrite rule to be applied to the document tree model between the parse and render operations.
Specifies a single block rewrite rule to be applied to the document tree model between the parse and render operations. This is identical to calling
Document.rewrite
directly, but if there is no need to otherwise access the document instance and just chain parse and render operations this hook is more convenient.The rule is a type alias for a partial function of type
PartialFunction[Block, RewriteRule[Block]]
.If the partial function is not defined for a specific block or the rule returns a
Retain
action as a result the old block remains in the tree unchanged.If it returns
Remove
then the block gets removed from the ast, if it returnsReplace
with a new block it will replace the old one.The rewriting is performed bottom-up (depth-first), therefore any element container passed to the rule only contains children which have already been processed.
-
def
usingRules(newRules: RewriteRules): ThisType
Specifies rewrite rules to be applied to the document tree model between the parse and render operations.
Specifies rewrite rules to be applied to the document tree model between the parse and render operations. This is identical to calling
Document.rewrite
directly, but if there is no need to otherwise access the document instance and just chain parse and render operations this hook is more convenient.The rules are partial functions of type
PartialFunction[T, RewriteRule[T]]
whereT
is eitherSpan
,Block
orTemplateSpan
, the 3 main categories of element types that support rewriting.If the partial function is not defined for a specific element or the rule returns a
Retain
action as a result the old element remains in the tree unchanged.If it returns
Remove
then the element gets removed from the ast, if it returnsReplace
with a new element it will replace the old one.The rewriting is performed bottom-up (depth-first), therefore any element container passed to the rule only contains children which have already been processed.
-
def
usingSpanRule(rule: RewriteRule[Span]): ThisType
Specifies a single span rewrite rule to be applied to the document tree model between the parse and render operations.
Specifies a single span rewrite rule to be applied to the document tree model between the parse and render operations. This is identical to calling
Document.rewrite
directly, but if there is no need to otherwise access the document instance and just chain parse and render operations this hook is more convenient.The rule is a type alias for a partial function of type
PartialFunction[Span, RewriteRule[Span]
.If the partial function is not defined for a specific span or the rule returns a
Retain
action as a result the old span remains in the tree unchanged.If it returns
Remove
then the span gets removed from the ast, if it returnsReplace
with a new span it will replace the old one.The rewriting is performed bottom-up (depth-first), therefore any element container passed to the rule only contains children which have already been processed.
-
def
usingTemplateRule(rule: RewriteRule[TemplateSpan]): ThisType
Specifies a single rewrite rule for template spans to be applied to the template tree model between the parse and render operations.
Specifies a single rewrite rule for template spans to be applied to the template tree model between the parse and render operations. This is identical to calling
TemplateDocument.rewrite
directly, but if there is no need to otherwise access the document instance and just chain parse and render operations this hook is more convenient.The rule is a type alias for a partial function of type
PartialFunction[TemplateSpan, RewriteRule[TemplateSpan]
.If the partial function is not defined for a specific span or the rule returns a
Retain
action as a result the old span remains in the tree unchanged.If it returns
Remove
then the span gets removed from the ast, if it returnsReplace
with a new span it will replace the old one.The rewriting is performed bottom-up (depth-first), therefore any element container passed to the rule only contains children which have already been processed.
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
withConfigValue[T](key: Key, value: T)(implicit arg0: ConfigEncoder[T]): ThisType
Returns a new instance with the specified configuration value added.
Returns a new instance with the specified configuration value added.
The specified value with have higher precedence than any value with the same key registered by extension bundles, but lower precedence than any value with the same key specified in a configuration file for a directory or a configuration header in a markup document.
- Definition Classes
- ParserBuilderOps
-
def
withConfigValue[T](key: String, value: T)(implicit arg0: ConfigEncoder[T]): ThisType
Returns a new instance with the specified configuration value added.
Returns a new instance with the specified configuration value added.
The specified value with have higher precedence than any value with the same key registered by extension bundles, but lower precedence than any value with the same key specified in a configuration file for a directory or a configuration header in a markup document.
- Definition Classes
- ParserBuilderOps
-
def
withConfigValue[T](value: T)(implicit arg0: ConfigEncoder[T], arg1: DefaultKey[T]): ThisType
Returns a new instance with the specified configuration value added.
Returns a new instance with the specified configuration value added.
The specified value with have higher precedence than any value with the same key registered by extension bundles, but lower precedence than any value with the same key specified in a configuration file for a directory or a configuration header in a markup document.
- Definition Classes
- ParserBuilderOps
-
def
withRawContent: ThisType
Enables all extensions that process raw content embedded into the host markup language.
Enables all extensions that process raw content embedded into the host markup language. These are disabled by default as Laika is designed to render to multiple output formats from a single input document. With raw content embedded the markup document is tied to a specific output format.
Technically it activates all
ExtensionBundle
instances which have theacceptRawContent
flag set to true.- Definition Classes
- ParserBuilderOps
Deprecated Value Members
-
def
creatingRule(newRules: (DocumentCursor) ⇒ RewriteRules): ThisType
- Annotations
- @deprecated
- Deprecated
(Since version 0.18.0) use buildingRule which includes error handling