Class/Object

laika.template

DefaultTemplate

Related Docs: object DefaultTemplate | package template

Permalink

class DefaultTemplate extends (Input) ⇒ TemplateDocument

The default (and currently only) parser implementation for templates. It supports the parsing of directives (starting with @:), of configuration sections at the start of the document (enclosed between {% and %}) and of context references (enclosed between {{ and }}). Everything else is treated as normal text and rendered unchanged.

Linear Supertypes
(Input) ⇒ TemplateDocument, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. DefaultTemplate
  2. Function1
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def andThen[A](g: (TemplateDocument) ⇒ A): (Input) ⇒ A

    Permalink
    Definition Classes
    Function1
    Annotations
    @unspecialized()
  5. def apply(input: Input): TemplateDocument

    Permalink

    The actual parser function, fully parsing the specified input and returning a document tree.

    The actual parser function, fully parsing the specified input and returning a document tree.

    Definition Classes
    DefaultTemplate → Function1
  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. def compose[A](g: (A) ⇒ Input): (A) ⇒ TemplateDocument

    Permalink
    Definition Classes
    Function1
    Annotations
    @unspecialized()
  9. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  13. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  14. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  15. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  16. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  17. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  18. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  19. def toString(): String

    Permalink
    Definition Classes
    Function1 → AnyRef → Any
  20. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  21. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. def withDirectives(directives: directive.Directives.Templates.Directive*): DefaultTemplate

    Permalink

    Adds the specified Laika directives and returns a new instance of the parser.

    Adds the specified Laika directives and returns a new instance of the parser.

    Example:

    val templates = DefaultTemplate withDirectives (
      Templates.create("ticket") {
        (attribute(Default) ~ attribute("param").optional) { (ticketNo, param) =>
          val base = "http://tickets.service.com/"+ticketNo
          val url = base + (param map (p => "¶m="+p) getOrElse "")
          TemplateElement(ExternalLink(Seq(Text("Ticket "+ticketNo)), url, options = Styles("ticket")))
        }
      }
    )
    
    Transform from Markdown to HTML withConfig RootDirectory("my-home")
        .withTemplateParser(ParseTemplate as templates)

    The code above registers a template directive that detects markup like @:ticket 2356. and turns it into an external link node for the URL http://tickets.service.com/2356.

    For more details on implementing Laika directives see laika.directive.Directives.

Inherited from (Input) ⇒ TemplateDocument

Inherited from AnyRef

Inherited from Any

Ungrouped