The old array was not quite optimal, and was not used optimally either.
- The `struct array` that was used for accessing link references has
been replaced with a minimal, fixed-width hash table. This should
be much more straightforward for small documents.
- The `struct parray` used as a string pool has been replaced with
a fast-growing stack. Realloc'ing once per push has never been a
good idea anyway.
Yey for losing boilerplate!
It is by the goodness of God that in our country we have those
three unspeakably precious things:
freedom of speech,
freedom of conscience,
and the prudence never to practice either of them.
-- Mark Twain, Following the Equator (1897)
SmartyPants is no longer an extension flag for the (X)HTML renderer, but
a separate method.
The new function `ups_xhtml_smartypants` external method is a
SmartyPants post-processor that takes an HTML document (e.g. a document
that has just been rendered with `ups_markdown`) and performs
SmartyPants substitutions in it.
This is the same approach that the original SmartyPants takes.
Postprocessing the HTML instead of performing the substitutions at the
Markdown level allows us to work around many problems of the old
implementation:
- Double quotes now properly open/close between different HTML
tags and blocks.
- Support for ``double quoting style'' has been added, and no
longer conflicts with Markdown code blocks.
- The limitations of the Upskirt parser (which was splitting
SmartyPants replacements mid-word in some cases because of active
character callbacks) no longer apply. All SmartyPants substitutions
work in all situations.
- The new parser is easily extendable with more substitutions.
The new SmartyPants parser is slightly faster than the old one.