Second Step: Make the Sample a Template

Once you have a concrete example of the output you want in hand, it’s easy to create an export template that allows you to produce an updated version of that output from any note. In order to turn my specific letter into an export template, I need to tell Tinderbox:

  1. where to insert information (i.e. indicate the “blanks” in the Mad Lib or the fill-in fields in Text Expander); and
  2. where the information to insert is located.

Both are easy.

Indicating “blanks”

In a template, if I write “Dear Michael Ondaatje,” Tinderbox will export that text exactly as written. If instead I want TBX to supply automatically the author information from whichever note I’m exporting, then I need to replace the specific author name by a bit of export code.

Export code—like queries, like actions—can seem at first glance intimidating.

Here’s the secret: all you need to make any of the basic templates in this series is:

^value()^

Anywhere you place this code in your template, you are telling Tinderbox to replace the code by the information stored in a note’s attribute. You are in other words, creating a blank line (or a fill-in field) in your template. (I’ll talk about the two exceptions to this procedure when creating a book note template.)

Pointing to Information

In a Mad Lib, each blank line had a brief instruction printed under it to tell you what kind of information was needed in order to fill in the blank appropriately. Tinderbox needs the same kind of instructions, and you give them by naming the attribute that holds the information you want to be used.

To do this, you simply place the name of the attribute inside the parenthesis in the export code. For example:

^value($Authors)^

That’s all there is to it.

The Changes Required in My Letter

Looking over my letter to Ondaatje, I can see two places where I would need to change information if I wanted to write to a different author: his name and the title of his book.

In my sample book notes, the author’s name is stored in $Authors and the books title is stored in $BookTitle. So to convert my letter to Ondaatje into a template, I would replace “Michael Ondaatje” by ^value($Authors)^ and “The English Patient” by ^value($BookTitle)^.

When I’m done, the letter now looks like this:

These changes made, set the prototype for the letter to “HTML Template” and you’re good to go. You can do this by:

  • assigning the template prototype directly; or
  • moving the revised letter to the templates container that was created when you imported the HTML Template.

Next step: assigning the template and previewing the output.