Skip to content
/ stencil Public

A simple Scala templating library that uses extra attributes to produce output based on plain html (or xml) files containing example markup.

License

Notifications You must be signed in to change notification settings

odd/stencil

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stencil

A simple Scala templating library that uses extra attributes to produce output based on plain HTML and XML files containing example markup.

The main idea is to keep the templates (or stencils) fully viewable in a browser with all example markup still there. The templating directives are therefore expressed as extra attributes on the existing markup elements. When the stencil is applied these attributes are removed from the output along with any surplus example markup.

Directives:

  • Let - binds an expression to a name
  • Set - sets an attribute value to the resolved value of an expression
  • Set Body - sets the body of the corresponding element to the resolved value of an expression
  • Do - repeats the corresponding element zero or more times based on the resolved value of an expression, each time binding a new value to the specified name
  • Do Body - repeats the corresponding element zero or more times based on the resolved value of an expression

Examples

<person x:set-name="person.name" name="Kalle"/> will produce the output <person name="Pelle"/> if and only if the expression person.name resolves to Pelle

<person x:let-name="person.name"><name x:set="name">Kalle</name></person> will produce the output <person><name>Pelle</name></person> iff the expression person.name resolves to Pelle

About

A simple Scala templating library that uses extra attributes to produce output based on plain html (or xml) files containing example markup.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages