oreillymedia/HTMLBook — pull request #74 by sandersk (2013-08-14 20:24:05+00:00)
Title: Footnote handling!!!

This pull request contains all the toolchain handling for footnote processing in accordance with the new footnote specs (see #73).

The way it works is that I've added a new $process.footnotes parameter that lets you turn on or off special processing for footnotes. By default, for single-chunk HTML postprocessing output, footnote processing is turned off, which means that content in `` blocks is passed through to the output untouched. This is what most folks will likely want for PDF output, where CSS3 can be used to float footnotes to the bottom of a page and insert the numerical markers.

For chunked/EPUB output, $process.footnotes is turned on, which means that footnote content is transformed into two pieces: a marker hyperlink at the location of the `` in the body text, which points at the footnote content placed in an `

` (or `

` for EPUB 2 fallback compatibility) at the end of the chunk. So, for example, the following:

````htrml

I owe it all to Project Unicorn.First footnote

````

gets transformed into (note that the two "1" footnote markers link back and forth to each other):

````html

I owe it all to Project Unicorn.1

1 First footnote

````