This tutorial explains the basics of exporting the notes arising from exploding a note into a set of per-note plain text (TXT) files. The process assumes starting with a blank file. It may be applied to a file already containing notes, adjusting instructions accordingly to allow for other content. The entire process uses the Outline view - of necessary add a new tab to your document and switch it to Outline view at root level.
This tutorial assumes the user is familiar with the note Explode control and the general basics of exporting. The Tinderbox version used is v6.1.3 running on OS 10.9.5.
1. Setting up a plain text export template
1-1. Adding the Prototype and Template containers
Open a new Tinderbox document and close the Map view tab - the task only requires outline view. From the File menu select Built-In Templates -> HTML. This single task sets up a number of things for you:
- The 'Prototypes' container, and the 'HTML Template' prototype. the latter is use as a default for all export template added and despite the title is useful as it turns up a number of Tinderbox text optimisations inappropriate for code or plain-text use.
- The 'Templates' container, and 'HTML Page' template. The latter isn't strictly needed but for now, adding it automatically sets up lots of structure that would otherwise need to be configured manually.
1-2. Add a plain-text template
Select the 'HTML Page' template, press Return to make a new note and call it 'plain-text'. You can now delete the 'HTML Page' template, or keep if you'd like to use it for other export purposes.
1-3. Add code to the plain-text template
Click into the text pane of the new note (the right hand pane of the main window), use shortcut Cmd+A to select all the default text and delete it. Now type the following code into the text view:
This export code simply tells Tinderbox to export the contents of a note's text (
$Text) verbatim, applying no mark-up of any kind.
The template is now complete and ready for use.
2. Setting up a prototype for the exploded notes
2-1. Add a new prototype
Select the prototype note 'HTML Template' press Return to make a new prototype and call it 'Explode-plaintext'. No $Text is needed.
2-2. Set the prototype's $OnAdd
With the prototype selected, open the Action Inspector and add the code shown:
Press Return to save the code.
2-3. Set the export template and filename extension
With the prototype still selected, switch to the HTML Inspector.
- In the Extension box replace the default extension '
.html' with '
.txt', as appropriate for plain text files.
- In the Template pop-up replace the default '
none' (or any other selected value) with '
/Templates/plain-text'. If the pop-up does not list the latter, revisit previous steps as you haven't correctly defined your export templates.
- Click the Export to button and select a folder to which the document will export. The default is the desktop (i.e.
~/Desktop), but in an pre-existing document you may have already set some other location.
Tip: the select export folder is the root folder of the export. All exporting notes will export to their relative outline location within that folder. Template and Prototype containers added by Tinderbox are preset to not export themselves or their children, which saves you some work.
2-4. Add a badge
Add a badge. Here the 'document' badge has been added. This step is not strictly necessary in general use of this export technique, but it is useful in helping see how the prototype gets applied during the Explode process.
3. Adding the content
Add a note called 'source' and paste your to-be-exploded content into its $Text.
Tip: the name of this note doesn't really matter. Using a given name here is only to help the less experienced user correctly find the exported files correctly.
4. Set the content's prototype
Select the new 'source' note and right click its note icon. From the pop-up list of available prototypes pick 'Explode-plaintext'.
5. Explode the content
Select 'source' and from the Note menu, Explode. Use the default settings (or as appropriate to your own data). Note that the 'exploded notes' sub-container and all the new notes all have the 'Explode-plaintext', due to the prototype $OnAdd.
Now, all the newly exploded notes that you wish to export as plain-text have the correct export template and filename extension applied, ready to export.
In this example, the Export folder (for the document) has been set to '
~/Desktop/Explode'. As 'source' is the only root level object set to export anything, it creates a 'source' folder - and a note with its $Text - and so on down the Outline to the folder holding the exported plain-text notes.
Tip: export can go only to the relative location to the root export folder you have set for the document (at least, as at v6.1.3)