Skip to content

13. Templates

Contents of FBL 0.17

A binding's template is the exact text of a new body. When the user creates a new document of a tool type:

  1. The host chooses the text: template.byOrigin[<origin>] when present for the tool type, else template.text; with a plugin reader and no template, the plugin's template operation.
  2. It replaces the placeholders, and nothing else: {name} (the new file's name), {base} (its base name), {key} (the base name with every character outside ASCII letters, digits and _ replaced by _, leading and trailing _ removed, _ prefixed when it then starts with a digit, and untitled when nothing is left), (FBL 0.10) {key:lower} ({key} with every ASCII letter in lower case, so My_Job.yml gives my_job), and {newid:<rule>} (a new id made by DISL's strategy for that rule's type). { and } not forming a placeholder are literal.
  3. It writes the file, and a registration when the binding is registrationOnly or the document needs one; it MUST NOT overwrite an existing file.

A template MUST read through its binding with no finding of severity warning or above; a validator that can read bindings checks it. The user's first edits are splices into the template's bytes like any others.

Referenced from