package dsl
- Alphabetic
- By Inheritance
- dsl
- Optimize
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- trait AttrDef extends AnyRef
- final class DslOptimizerMacro extends AnyRef
- trait Optimize extends AnyRef
- trait StyleDef extends AnyRef
- class SymbolDsl[MiscType] extends AnyRef
Symbol based DSL allows to define documents.
Symbol based DSL allows to define documents. Deprecated because Scala 2.13 drops support of symbol literals.
'body( 'h1(class /= "title", "Hello World"), 'p("Lorem ipsum dolor") )
- final class SymbolDslMacro extends AnyRef
- trait TagDef extends AnyRef
Value Members
- def AttrDef(namespace: XmlNs, attrName: String): AttrDef
- def AttrDef(attrName: String): AttrDef
- def StyleDef(styleName: String): StyleDef
- def TagDef(namespace: XmlNs, tagName: String): TagDef
- def TagDef(tagName: String): TagDef
- implicit def arbitraryOptionToNode[M, T](value: Option[T])(implicit ev: (T) => Node[M]): Node[M]
Converts option of T (which can be converted to Node) to document node
- implicit def arbitrarySeqToNode[M, T](xs: Iterable[T])(implicit ev: (T) => Node[M]): Node[M]
Converts sequence of T (which can be converted to Node) to document fragment
- implicit def miscToNode[M](value: M): Node[M]
Converts MiscType to text document node
- macro def optimize[T](node: Node[T]): Node[T]
Optimize template to monolith (if possible) levsha.Document.Node in compile time.
Optimize template to monolith (if possible) levsha.Document.Node in compile time. Note this method touched by non-idempotent typechecking bug of Scala compiler. It means, sometimes your code could be broken. Try not to insert non-DSL code into
optimize {}
call.- Definition Classes
- Optimize
- See also
https://github.com/scala/bug/issues/5464
https://github.com/fomkin/levsha#memory-allocation-model-explanation
- implicit def optionToAttr[M](value: Option[Attr[M]]): Attr[M]
Implicitly unwraps optional attributes
- implicit def optionToNode[M](value: Option[Node[M]]): Node[M]
Implicitly unwraps optional documents
- implicit def optionToStyle[M](value: Option[Style[M]]): Style[M]
Implicitly unwraps optional styles
- val preventDefaultClickBehavior: Attr[Nothing]
Use it when want overwrite default click behavior.
Use it when want overwrite default click behavior.
a(href := "http://example.com", preventDefaultClickBehavior)
- implicit def seqToAttr[M](xs: Iterable[Attr[M]]): Attr[M]
Converts iterable of attributes to document one attr
- implicit def seqToNode[M](xs: Iterable[Node[M]]): Node[M]
Converts iterable of templates to document fragment
- implicit def seqToStyle[M](xs: Iterable[Style[M]]): Style[M]
Converts iterable of attributes to document one style
- implicit def stringToNode[M](value: String): Node[M]
Converts String to text document node
- def void[T]: Node[T] with Attr[T]
- def when[T](condition: Boolean)(doc: Document[T]): Document[T]
Add node or attribute conditionally
Add node or attribute conditionally
button( when(inProgress)(disabled) "Push me" )
Example: - object html
HTML Tags, Attributes, and Styles specification
- object svg
https://developer.mozilla.org/en-US/docs/Web/SVG