Tinderbox content can be exported in OPML using appropriate templates, taking care to encode for XML standards and to encode paragraph breaks in $Text.
Zero-configuration OPML Export
Use File menu ▸ Export ▸ as Text and on the resulting dialog select the OPML option, offering a choice of scope. If not already present in the document, using this export for the first time will add the necessary built-in templates (and their required prototypes) to the document. If document scope is selected, root level back-of-house containers such as Prototypes
will not be exported as per their default settings.
IMPORTANT: be aware that many apps offering OPML input/output use customised variants of the main standard. Thus it is simply not safe to assume that OMPL will 'just work' in all cases. It may be necessary make adjustments to the OMPL templates to generate OPML output that reflects the (usually undocumented) non-standard OMPL aspects of some apps expected OPML input.
See also OPML Import.
Zero-configuration Scrivener (OPML) Export
To assist Scrivener users not confident with export, a similar methods as above is offered. At the Export as Text dialog, select 'Scrivener' and set the scope. As above Template and Prototypes are added as needed.
OPML standard and variations
The formal OPML (v2.0) standard is still quite loose allowing for variations. The following is a list of mappings of TB attributes to standard and common non-standard OPML attributes (non-standard tags in italics):
- $Name → text
- $Text → _note
- $Checked → _status
Note that the OPML <expansionState>
element is not supported. Tinderbox's outline branch expand/collapse state is not accessible as an attribute to populate this OPML tag. However, for data validation's sake, do include the empty tag (<expansionState>
) in any export templates.
Dates in OPML. If the user wishes to use the optional 'created
' OPML attribute, then RFC 822 formatted dates should be used. For example:
created="^value($Created.format("*"))^"
outputs (on aTbRef's author's system)
created="Thu, 14 Jan 2010 08:58:47 +0000"
For considerations relating to import, see OPML Import.
OPML Templates
Tinderbox supplies built-in OPML templates that can be added to a document from the File menu. In addition, the following code operators are provided to assist with OPML export:
- attributeEncode()
- ^opmlEncode()^ (now deprecated in favour of the above)
A pair of wrapper/item templates, similar to those below, were added to the built-in templates. Scrivener users get similar (OPML-based) template for export for ingest Scrivener.
Below are specimen templates for OPML export. Use the 'OPML-wrapper' template with a container note containing all the top level note(s) forming the actual OPML items. The 'OPML-wrapper' calls the 'OPML-item' template which then recursively calls itself to build out the OPML outline:
Scrivener OPML
The build-in templates for Scrivener are actually exactly the same as those for OMPL. The duplication reflects the fact that many Scrivener users may not be wll versed on the 'code' aspect of export.
Setting the correct file type on export
If exporting OPML, the $HTMLExportExtension should be set to '.opml
'. If using the built-in templates, this is done automatically via this code:
^action($HTMLExportExtension=".opml")^
If the the same note/container is normally used for HTML export, consider removing the above code and setting the extension manually on save. Or make a note for OPML export but which uses an ^include()^ call to export the content whose default export is HTML.