FLM Feature flm.feature.substmacros

User-defined substitution macros, environments, and specials for FLM.

Allows defining custom LaTeX-like macros and environments whose content is specified as FLM template strings with argument placeholders (#1, #{argname}). Substitutions are expanded at render time.

class flm.feature.substmacros.FeatureSubstMacros(definitions: TypeSubstDefinitions | None)

Bases: Feature

Feature that registers user-defined substitution macros, environments, and specials. Each definition maps a macro/environment name to a content template with argument placeholders that are expanded during rendering.

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.FLMDocument is instantiated. This class is expected to be a subclass of flm.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 (see flm.flmdocument.FLMDocument.render(), and more specifically flm.flmdocument.FLMDocument.make_render_context()). This class is expected to be a subclass of flm.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.

feature_name: str | None = 'macros'

A name that should uniquely identify this feature.

feature_title: str | None = 'Custom macros definitions'

Descriptive name or title for this feature.

add_latex_context_definitions()

Reimplement to add additional definitions to the latex context database.

flm.feature.substmacros.FeatureClass = <class 'flm.feature.substmacros.FeatureSubstMacros'>

Feature that registers user-defined substitution macros, environments, and specials. Each definition maps a macro/environment name to a content template with argument placeholders that are expanded during rendering.