August 12, 2007
MarkBernstein.org
 

Tinderbox 4: ^value

When you want to export information from Tinderbox to HTML, or XML, or OPML, or whatnot, you make a sample file or template that explains what the exported document should look like, adding placeholders such as ^text and de>^text to show where the information from your notes should go.

Most of the time, you only need to remember a handful of these placeholders. But occasionally you might need to get fancy, and so Tinderbox gives you lots of special-purpose placeholders. (The new manual for Tinderbox 4 does a nice job of keeping track of them)

Before Tinderbox 4, you sometimes also used export templates in queries and actions. In Tinderbox 4, though, there are lots of new capabilities in actions. So you don't need to fiddle with export template unless you're, well, exporting.

In fact, there's a nifty new placeholder in export templates that lets you forget almost all those special-purpose placeholders.

^value(expression)

^Value evaluates an action expression and exports the value. So, ^value($WordCount) exports the note's word count, and ^value($Name) exports the note's name. You can do calculations if you need to: ^value(1.15*$Price(parent)) exports the price of the note's container after a 15% markup.

Conversely, the function exportedString(what,template) lets an action apply an export template to a note and store the result in any string attribute.

^Value is nearly the universal placeholder; you can forget now most of what you know about Tinderbox export templates and concentrate on all the interesting new actions.