package
0.0.5
Repository: https://github.com/toolvox/utilgo.git
Documentation: pkg.go.dev

# README

TMPLZ

Recursive, Non-intrusive templates.

Rules

  • A Template can be defined on its own or in a group with others.
    • Templates defined together can reference each other.
  • Unused Variables are assumed to be literals.
  • A Variable clause begins with a Prefix(e.g. @).
    • A Variable clause may terminate with a Suffix(e.g. _).
    • Additional Prefixes increase the "depth" of the Variable.
    • Suffixes within a Variable can be used to escape the "depth".
  • Use Prefixes and Suffixes to create a Variable Graph.

Examples

All examples explicitly include the suffix even when it can be ignored. (Optional suffixes denoted )

  1. Zero Variables:
    • @ by itself is not a variable.
    • @_ evaluates to _.
  2. One Variable:
    • A standard template variable: @solo‗ -> {@solo_}.
  3. Two Variables:
    • Two standard variables one after the other: @one_@two‗ -> {@one_}{@two_}.
      • Assigning one does not affect the other.
    • A variable with a sub-variable: @one@two‗‗ -> {@one@two__{@two_}}.
      • Neither @one nor @one@two can be assigned to.
      • You must first assign @two and that will set the actual name of @one@two.
        • e.g. ["two" -> "123"] then @one@two__ becomes @one123_.