June 5, 2008
MarkBernstein.org
 
Follow me on Twitter

Minding your tau's and delta's

When exporting to HTML, Tinderbox converts a whole slew of characters to HTML entities. Your curly quotes will stay curly, and won't generate mysterious black boxes in Windows or Linux. Your trademarks™ will be preserved and your © copyrights reserved.

But perhaps there’s an entity you want to use, that Tinderbox leaves alone. You might use a macro. I say ^do(check) and you see ‘✓’. But perhaps that's too ugly. You could tell us what you need — we’re usually happy to add new entities that people fine helpful — but perhaps you need this today.

Here's how to do it yourself: add an HTMLExportCommand to filter the exported output. One correspondent needed to export the character Δ (option-J), which can be encoded as Δ or Δ . An HTMLExportCommand that does this is simply:

perl -pi -e 's/Δ/Δ/g'

Perl tends to be cryptic, but this is easy to follow. The "s" means we want to substitute one string for another. The string we're looking for comes between the first two slashes, and its replacement comes between the second and the last slash.