FLM Feature flm.feature.enumeration¶
Provides enumeration and itemization list environments for FLM.
Defines the itemize, enumerate, and description environments with
configurable counter formatters, custom item tags via \item[...], nested
list support with depth-dependent formatting, and optional \label on
individual items for cross-referencing.
- class flm.feature.enumeration.Enumeration(environmentname: str, *, counter_formatter: Sequence[Literal['alph', 'Alph', 'roman', 'Roman', 'arabic', 'fnsymbol', 'unicodesuperscript', 'unicodesubscript'] | TypeFormatNumTemplate | Callable[[int], str] | str] | None = None, annotations=None, **kwargs)¶
Bases:
FLMEnvironmentSpecBaseSpec info for an enumeration or itemization list environment.
Handles
itemize,enumerate,description, or any custom list environment. Parses\itemmacros (with optional[custom tag]and\labelarguments) inside the environment body.The counter_formatter controls how item tags are displayed:
A fixed string – used verbatim as every item tag.
A callable – called with an integer (starting at 1) and returns the tag string.
A list of the above – elements correspond to nesting depths. The first element is used for the outermost list, the second for the first nested list, and so on.
- 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.
- body_contents_is_block_level: bool | None = True¶
Applicable only to environment specifications. Specifies whether or not the body contents of the body should be parsed as block-level code or not. By default, environment contents are parsed in the same mode as the surrounding content.
- 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_item_label_prefixes = ('item',)¶
- make_body_parser(token, nodeargd, arg_parsing_state_delta)¶
- postprocess_parsed_node(node)¶
- render(node, render_context)¶
- recompose_pure_latex(node, recomposer)¶
- class flm.feature.enumeration.FeatureEnumeration(enumeration_environments: Mapping[str, TypeEnumerationEnvironmentDef] | None = None)¶
Bases:
FeatureAdd support for enumeration and itemization lists, e.g., via LaTeX commands
\begin{enumerate} ... \end{enumerate}and\begin{itemize} ... \end{itemize}.- feature_title: str | None = 'Enumeration and itemization lists'¶
Descriptive name or title for this feature.
- feature_default_config: Mapping = {'enumeration_environments': {'description': {'counter_formatter': ['<??>', '<??>', '<??>']}, 'enumerate': {'counter_formatter': None}, 'itemize': {'counter_formatter': ['•', '-', '▸']}}}¶
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.
- DocumentManager: Type[FeatureDocumentManagerBase] | None = None¶
The document manager class to use for this feature. Instances of this class will automatically be created when a new
flmdocument.FLMDocumentis instantiated. This class is expected to be a subclass offlm.feature.FeatureDocumentManagerBase. Alternatively, set this class attribute to None in your feature subclass to indicate that this feature does not need any document manager instance.
- RenderManager: Type[FeatureRenderManagerBase] | None = None¶
The render manager class to use for this feature. Instances of this class will automatically be created when rendering a
flmdocument.FLMDocument(seeflm.flmdocument.FLMDocument.render(), and more specificallyflm.flmdocument.FLMDocument.make_render_context()). This class is expected to be a subclass offlm.feature.FeatureRenderManagerBase. Alternatively, set this class attribute to None in your feature subclass to indicate that this feature does not need any document manager instance.
- add_latex_context_definitions() TypeDictWithLatexContextDefinitions¶
- flm.feature.enumeration.FeatureClass = <class 'flm.feature.enumeration.FeatureEnumeration'>¶
Add support for enumeration and itemization lists, e.g., via LaTeX commands
\begin{enumerate} ... \end{enumerate}and\begin{itemize} ... \end{itemize}.