# Exporting to HTML

Tinderbox provides exceptionally powerful and flexible export to HTML, XML, and many other formats. Every Web site and application has unique needs and requirements; Tinderbox makes it easy to pour information from your Tinderbox notes into files that meet your exact needs.

Indeed, Tinderbox templates can export data to all sorts of other programs and formats. Since HTML and XML are likely the most common formats in use today, our discussion will focus on these.

## How Export Works

Tinderbox uses templates to understand how your notes should be formatted as Web pages.

The template is simply a note with text that looks like the information you want to export, with placeholders to indicate the location of information Tinderbox is to take from your document. The template is a form the Tinderbox fills out, in which placeholders to represent blanks and boxes that into which Tinderbox inserts information from your notes.

Many different notes can use the same template. Exporting them will create many Web pages, with different content—different titles, text, links, and so on—but in the same format on each Web page. Other notes may use a different format, and so may require a different template.

## Templates

A template note is simply an a note in which special codes, or placeholders have been placed in the text to indicate where Tinderbox should insert information from each note. For example, `^title^` is replaced by the title of the note, and `^text^` is replaced by the text of the note.

Tinderbox defines a host of placeholders for various purposes, but the majority of these are seldom required very rarely. The principal placeholders are:

- ^title^
- ^text^
- ^value^
- ^include^
- ^children^

These will suffice for many users.

When you export a document, Tinderbox takes each note, puts information in the appropriate places in the appropriate template, and thus creates a new file for that note.

### Making A Template Note

To tell Tinderbox that a note should serve as a template:

1. Select that note
2. Open the Properties Inspector and switch to the Prototype pane
3. Check the Template checkbox

A variety of built-in templates may be added to your document automatically; choose those you want from File ▸ Built-In Templates.

## Exporting Information

### What will transfer to the export

Text. The text in your notes translates to text on Web pages. Characters that must be translated or encoded in HTML, such as © and typographic quotes, will be translated appropriately.

Images. Images will be placed in the translated Web pages where they appear in the Tinderbox notes. Tinderbox will automatically translate the image files into fo either JPEG or PNG file.

Text links. Tinderbox links from portions of text will translate into links from that text on the web page to other exported notes or external web links.

### What will transfer in part

Text appearance. Tinderbox’s translation attempts to translate text styles, such as italics, boldface, and relative size, to similar text styles on most Web browsers.

The translation also attempts to recognize such meaningful items as headings and lists, and create appropriate HTML to display those items. Tinderbox has a simple lists feature that treats a paragraph beginning with an asterisk as an unordered list; use two or more asterisks to embed lists within lists.

Or, you can instruct Tinderbox to leave your text exactly as written—you will want to do this if you have incorporated Web formatting codes into your text already; do this using ^text(plain)^.

Lists. Tinderbox has a simple lists feature that treats a paragraph beginning with an asterisk or bullet (• ⌘⌥-8) as an unordered list. Use two or more asterisks to embed lists within lists.

Ordered lists may be created by beginning new paragraphs with the '#' symbol.

Basic links. If you choose, Tinderbox can add links to each Web page corresponding to the basic links from that note.

Hierarchy. If you choose, by adding appropriate export codes Tinderbox can create additional links from text on each Web page to provide access to the notes that are nearby in the Tinderbox hierarchy (ancestors, siblings, children, etc.).

Overlapping text links. In HTML, text links may not overlap. Text in a note that is the source of more than one link is linked on the Web to a special Web page listing the links that can be followed.

## Additional Export Elements

The most common elements in export templates include

- ^title^
- ^text^
- ^value^
- ^include^
- ^children^

Other elements are occasionally useful.

^action(...) performs a Tinderbox action or a series of actions separated by semicolons. This element exports nothing, but can be useful for setting the locale or performing other actions before or during export.

^exists(...) returns true if the designated note exists, and false otherwise.

^firstSibling, ^nextSibling, ^previousSibling, ^lastSibling

return the relative URL of a sibling of this note. These can be useful for creating navigational links: <a href="^nextSibling^&">Next</a>.

^indent(n,c) exports n instances of the string c. If c is omitted, exports n tab characters.

^lowerCase(...) and ^upperCase(...) convert arbitrary strings to lowercase or uppercase letters.

^opmlencode(...) encodes any string, escaping characters that may not appear in OPML.

^randomChildOf exports one randomly-chosen child of a this note or, if an argument is supplied, one randomly-chosen child of the designated note.

^url exports the relative URL of the designated note, relative to current, the page being exported.

^urlencode(...) encodes any string, escaping characters that may not appear in URLs.

^version exports the current Tinderbox version.