Added support for "acronym plurals", the "glossaries" LaTeX package, and a configurable acronym label creation. #115
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added support for "acronym plurals"
Now an acronym defined as
can be referenced in a text by
Producing
In order to achieve this,
find_abbreviations()[in writer.c] has to "partially" match an abbreviation and pass a detected plural along the correspondingnode->key. Thus, a new node key typeABBRPLURALhas been introduced [in libMultiMarkdown.h] and propagated in allprint_*_node()functions (though only an implementation for LaTeX has been provided).As the partial abbreviation lookup would've necessitated frequent calls of
strlen(), performance optimization dictated to extend the node structure by adding alenelement. To avoid an irresponsible memory increase, an intentional small data typeunsigned short inthas been proposed. The chosen data type is (build) configurable by introducing an abstractNODE_LENtype and severaltypedefmacros [in libMultiMarkdown.h] Repercussions are: an optimizedstrdup()replacementstrdup_ext()providing a string's length, optimizations of thetrim_*()functions, and alteration of all node creations and node copies.Added support for the LaTeX glossaries package
Glossaries package provided by Nicola Talbot (see http://www.ctan.org/pkg/glossaries).
For longer documents this package allows a better acronym and glossary management. Due to its preferred workflow, which requires a separate
makeidxcall, it seems impossible to avoid the introduced code changes by applying TeX's\renewcommandand substituting MMD's supported\acand\newacrocommands instead. By specifying the metadata keythe preferred acronym package can be selected. Omitting the "LaTeX Acronym Package" key selects, of course, MMD's default behavior, i.e., "acronym package" support.
For this feature the
METAKEY,ABBREVIATION, andABBRswitch-cases inprint_latex_node()[in latex.c] and thescratch_padstruct [in parser.h] have been modified. An additionalenum latex_acronym_packagehas been introduced. The additionalscratch_padelementlatex_acronym_configis stored in a compact way.Added support for configuring an acronym's label creation
MMD current preference for creating labels is to avoid duplicate acronym keys by concatenating an acronym key with the acronym's text. This makes manual referencing of acronym labels very difficult. Unfortunately, manual acronym referencing in unavoidable, when longer documents are written, e.g., intentionally selecting the full acronym text after its first mentioning, using acronyms in "HTML comment escaped" LaTeX blocks like abstracts, etc.
By specifying the metadata key
the preferred acronym label creation style can be selected. Omitting the "LaTeX Acronym Label style" key selects, of course, MMD's default behavior, i.e., "full" label creation.
For this feature the
METAKEY,ABBREVIATION, andABBRswitch-cases inprint_latex_node()[in latex.c] and thescratch_padstruct [in parser.h] have been modified. An additionalenum latex_acronym_label_stylehas been introduced. The additionalscratch_padelementlatex_acronym_configis stored in a compact way.