FLM Feature flm.feature.headings¶
Provides section heading macros for FLM.
Defines \section, \subsection, \subsubsection, \paragraph,
\subparagraph, and \subsubparagraph with configurable heading levels,
optional hierarchical numbering, and \label support for cross-references.
- class flm.feature.headings.HeadingMacro(macroname, *, heading_level=1, inline_heading=False, unregistered_heading=False, target_id=None)¶
Bases:
FLMMacroSpecBase- is_block_level: bool | None = True¶
If this flag is set to True, then elements of this type are always parsed as separate block-level elements (e.g., a section heading, an enumeration list, etc.)
If this flag is None, then the spec does not commit as to whether the node produces a block-level or inline-level element. It is strongly recommended you then manually set the flm_is_block_level attribute on the node object to True or False, since the default implementation of finalize_node() won’t be able to do it.
- allowed_in_standalone_mode: bool = True¶
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.
- allowed_ref_label_prefixes = ('sec', 'topic')¶
- get_flm_doc()¶
- postprocess_parsed_node(node)¶
- render(node, render_context)¶
- recompose_pure_latex(node, recomposer)¶
- class flm.feature.headings.FeatureHeadings(section_commands_by_level: Mapping[int, TypeSectionCommandDef | str] | None = None, numbering_section_depth: int | bool | None = False, counter_formatter: None | TypeCounterFormatter | Literal['alph', 'Alph', 'roman', 'Roman', 'arabic', 'fnsymbol', 'unicodesuperscript', 'unicodesubscript'] | TypeFormatNumTemplate | TypeCounterFormatterSpecDict = None, section_numbering_by_level: Mapping[int, None | TypeSectionNumberingDef] | None = None)¶
Bases:
FeatureAdd support for headings via LaTeX commands, including
\section,\subsection,\subsubsection,\paragraph, etc.- feature_title: str | None = 'Headings: sections, paragraphs'¶
Descriptive name or title for this feature.
- feature_optional_dependencies: Set[str] | Sequence[str] | None = ['refs', 'numbering']¶
If non-None, then this is a list (or set) of feature names that may enhance the functionality of the present feature. If these features are activated, they will be initialized prior to the present feature.
- class RenderManager(feature_document_manager, render_context, **kwargs)¶
Bases:
FeatureRenderManagerBase- initialize(numbering_section_depth: int | bool | None = None, section_numbering_by_level: Mapping[int, None | TypeSectionNumberingDef] | None = None, counter_formatter: None | TypeCounterFormatter | Literal['alph', 'Alph', 'roman', 'Roman', 'arabic', 'fnsymbol', 'unicodesuperscript', 'unicodesubscript'] | TypeFormatNumTemplate | TypeCounterFormatterSpecDict = None)¶
- new_heading(node, heading_level, labels, heading_content_nodelist, skip_numbering=False, unregistered_heading=False, target_id=None)¶
- get_default_target_id(heading_labels, heading_content_nodelist, *, node)¶
- class SectionNumberingInfo(numprefix: None | str = None, heading_joiner: str = ' ', number_within_reset_at: str | bool | None = True, counter_formatter: None | TypeCounterFormatter | Literal['alph', 'Alph', 'roman', 'Roman', 'arabic', 'fnsymbol', 'unicodesuperscript', 'unicodesubscript'] | TypeFormatNumTemplate | TypeCounterFormatterSpecDict = None)¶
Bases:
objectDoc…
The number_within_reset_at sets the parent counter to number this heading level within. If set to None, there will be no parent counter and this section level is numbered throughout. If set to True, then the parent counter is determined automatically (no parent counter for top-level heading and last numbered heading level for sub-headings).
- feature_default_config: Mapping = {'counter_formatter': {'delimiters': ('', ''), 'format_num': {'template': '${arabic}'}, 'join_spec': 'compact', 'prefix_display': {'plural': '§\u2009', 'singular': '§\u2009'}}, 'section_commands_by_level': {'$no-merge': True, 1: {'cmdname': 'section'}, 2: {'cmdname': 'subsection'}, 3: {'cmdname': 'subsubsection'}, 4: {'cmdname': 'paragraph', 'inline': True}, 5: {'cmdname': 'subparagraph', 'inline': True}, 6: {'cmdname': 'subsubparagraph', 'inline': True}}, 'section_numbering_by_level': {'$no-merge': True, 1: {'counter_formatter': {'template': '${arabic}'}, 'heading_joiner': '. ', 'numprefix': None}, 2: {'counter_formatter': {'template': '${arabic}'}, 'heading_joiner': '. ', 'numprefix': '${section}.'}, 3: {'counter_formatter': {'template': '${arabic}'}, 'heading_joiner': '. ', 'numprefix': '${subsection}.'}, 4: {'counter_formatter': {'template': '${alph}'}, 'heading_joiner': '. ', 'numprefix': None}, 5: {'counter_formatter': {'template': '${alph}'}, 'heading_joiner': '. ', 'numprefix': '${paragraph}.'}, 6: {'counter_formatter': {'template': '${alph}'}, 'heading_joiner': '. ', 'numprefix': '${subparagraph}.'}}}¶
The default configuration tree for this feature. The
runmodule uses these defaults when no configuration is specified for a given feature. Recall that the configuration is a dictionary of key/value pairs that will be specified byrunas keyword arguments to the constructor of the feature instance. If you create feature instances yourself, then you’re responsible anyways for the arguments you specify to the constructor, and you are responsible for honoring or ignoring the values in feature_default_config.
- add_latex_context_definitions()¶
- flm.feature.headings.FeatureClass = <class 'flm.feature.headings.FeatureHeadings'>¶
Add support for headings via LaTeX commands, including
\section,\subsection,\subsubsection,\paragraph, etc.