Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor content parsing and ref resolution
Reference resolution logic has been moved from the renderer to the parser (invoked by the prerenderer), where refs are now converted to markdown links using an intermediate `luadox:<refid>` link format. It's up to the renderer to resolve these links to whatever is appropriate. This required introducing the notion of an id to references. Ids are globally unique opaque strings that are tracked by the parser, which the renderer can consult in order to convert an id to a Reference object. This refactoring continues to pave the way for #5 and will allow for different kinds of renderers (not just HTML), where the common logic that applies to all renderers has been moved to the parser and run during the prerender stage. Additionally, tag parsing within content blocks (e.g. handling @tparam, @note, etc.) has been rewritten and hopefully simplified. (Parser.parse_raw_content()) Finally, this commit includes some optimizations: * Compiled regexp objects are now cached and reused, reducing compilation overhead * First sentence detection has been rewritten using a more naive, lower level approach that is significantly faster. During profiling, get_first_sentence() was the most disproportionately expensive functions called.
- Loading branch information