FLM Feature flm.feature.endnotes

Provides endnote support (footnotes, citations, and similar) with per-category counters, customizable formatting, and rendering of collected endnotes as enumerated lists with optional category headings.

class flm.feature.endnotes.EndnoteCategory(category_name: str, counter_formatter: None | TypeCounterFormatter | Literal['alph', 'Alph', 'roman', 'Roman', 'arabic', 'fnsymbol', 'unicodesuperscript', 'unicodesubscript'] | TypeFormatNumTemplate | TypeCounterFormatterSpecDict, heading_title: str, endnote_command: None | str = None)

The counter_formatter can be one of the keys in counter.standard_counter_formatters for instance. Or it can be a callable. It should return FLM text to use to represent the value of the counter.

The endnote_command provides a simple way of defining a macro that adds an endnote of this category. If non-None, then it should be a macro name (no backslash) that will be defined and whose behavior is to add an endnote of the given content in this endnote category. The macro will take a single mandatory argument, the contents of the endnote, think like footnote{…}. Leave this to None to not define such a macro.

class flm.feature.endnotes.EndnoteMacro(macroname, endnote_category_name, **kwargs)

Bases: FLMMacroSpecBase

Macro spec that inserts an endnote of a given category.

When rendered, it registers the endnote content with the endnotes render manager and returns the formatted endnote mark (e.g. a superscript number linking to the endnote list).

allowed_in_standalone_mode: bool = False

Whether or not this node is allowed in standalone mode, i.e., whether or not this node can be rendered independently of any document object.

get_flm_doc()
render(node, render_context)
class flm.feature.endnotes.EndnoteInstance(category_name, number, formatted_counter_value_flm, content_nodelist, ref_label_prefix, ref_label)

Data object representing a single registered endnote.

Created by FeatureEndnotes.RenderManager.add_endnote() during rendering. Carries the endnote’s category, assigned number, formatted counter value, content node list, and optional reference label information.

asdict()
class flm.feature.endnotes.FeatureEndnotes(categories: Sequence[TypeEndnoteCategoryDef] | None = None, render_options: Mapping[str, Any] | None = None)

Bases: Feature

Feature plugin for endnotes such as footnotes and citations. Accepts a list of EndnoteCategory instances, each defining a counter format, heading title, and optional macro (e.g., \footnote). Endnotes are collected during rendering and can be output as enumerated lists grouped by category.

feature_name: str | None = 'endnotes'

A name that should uniquely identify this feature.

feature_title: str | None = 'Endnotes: footnotes, references, etc.'

Descriptive name or title for this feature.

feature_flm_doc()
add_latex_context_definitions()
class DocumentManager(feature, doc, **kwargs)

Bases: FeatureDocumentManagerBase

initialize()
add_endnote_category(endnote_category)
class RenderManager(feature_document_manager, render_context, **kwargs)

Bases: FeatureRenderManagerBase

initialize(inhibit_render_endnote_marks: bool = False)
add_endnote(category_name, content_nodelist, *, node, ref_label_prefix=None, ref_label=None)
render_endnote_mark(endnote, display_flm=None, wrap_with_semantic_span='endnote-marks')

Render the endnote mark for the given endnote. You can replace the mark’s displayed content by specifying the display_flm argument. The latter must be a FLMFragment instance or a pylatexenc.latexnodes.nodes.LatexNodesList instance.

render_endnote_mark_many(endnote_list, *, counter_prefix_variant=None, counter_with_delimiters=True, counter_with_prefix=False, wrap_with_semantic_span='endnote-marks')
render_endnotes_category(category_name)
render_endnotes(target_id='endnotes', annotations=None, include_headings_at_level=None, set_headings_target_ids=None, endnotes_heading_title=None, endnotes_heading_level=None)
flm.feature.endnotes.FeatureClass = <class 'flm.feature.endnotes.FeatureEndnotes'>

Feature plugin for endnotes such as footnotes and citations. Accepts a list of EndnoteCategory instances, each defining a counter format, heading title, and optional macro (e.g., \footnote). Endnotes are collected during rendering and can be output as enumerated lists grouped by category.