t

laika.api.builder

TransformerBuilderOps

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).

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. TransformerBuilderOps
  2. RendererBuilderOps
  3. ParserBuilderOps
  4. CommonBuilderOps
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. 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

  1. abstract def config: OperationConfig

    The current configuration for this instance.

    The current configuration for this instance.

    Attributes
    protected
    Definition Classes
    CommonBuilderOps
  2. abstract def renderFormat: RenderFormat[FMT]
    Attributes
    protected
    Definition Classes
    RendererBuilderOps
  3. 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

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. 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 a DocumentCursor 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]] where T is either Span, Block or TemplateSpan, 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 returns Replace 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.

  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  9. 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
  10. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  12. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  15. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  16. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  17. 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
  18. 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
  19. 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 the useInStrictMode flag set to true.

    Definition Classes
    ParserBuilderOps
  20. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  21. def toString(): String
    Definition Classes
    AnyRef → Any
  22. 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
  23. 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
  24. 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 returns Replace 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.

  25. 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]] where T is either Span, Block or TemplateSpan, 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 returns Replace 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.

  26. 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 returns Replace 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.

  27. 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 returns Replace 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.

  28. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  31. 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
  32. 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
  33. 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
  34. 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 the acceptRawContent flag set to true.

    Definition Classes
    ParserBuilderOps

Deprecated Value Members

  1. def creatingRule(newRules: (DocumentCursor) ⇒ RewriteRules): ThisType
    Annotations
    @deprecated
    Deprecated

    (Since version 0.18.0) use buildingRule which includes error handling

Inherited from RendererBuilderOps[FMT]

Inherited from ParserBuilderOps

Inherited from CommonBuilderOps

Inherited from AnyRef

Inherited from Any

Ungrouped