hairy text templates

Overview of Bit Powder text templates, called hair, and is like handlebars and mustache (and the earlier ctemplate original). In short the features and syntax:

binexpr expressions can be used instead of values as above (think of expressions, functional calls, selectors, etc). This utility supports also Lua in the templates. Prefix anywhere a value is accepted with lua: to run Lua code (with current value in this).

There are a couple of special functions added to the Binary Object expressions:

{{define cardfeature defaults {fillHeight: true, dark: false, photoHideBreakpoint: "md"}}}
[[{.card{{if !dark}}; .light{{end}}}
  [[{.card-header}
    :fas-{{=icon}}:{.mr-2}
    {{=title}}
  ]]
  ...
  {{=eval(body, this)}}
  ...
  ]
]]
{{end}}

{{call cardfeature with {
  dark: true,
  icon: "calendar-star",
  title: "Upcoming",
  body: compile(|
    On **Tuesday 1 December** from **16:00 - 17:30**, *X* will present her recently published book 'XYZ'.
  ),
  buttonLeft: {icon: "sign-in", name: "join", href: "http://"},
  buttonRight: {icon: "calendar", name: "calendar feed", href: "http://"}
}}}
listing 1 example combining markdown with text templates.