FLM Feature flm.feature.cells¶
Provides the \begin{cells}...\end{cells} environment for typesetting data
tables. Cells can be placed individually with \cell or in bulk with
\celldata; merging across rows or columns is supported via \merge.
The cell grid model is built at parse time and rendered to HTML tables or
LaTeX tblr environments.
Cells LaTeX macro specs¶
- class flm.feature.cells.LatexTabularColumnSeparatorSpec¶
Bases:
SpecialsSpec
- class flm.feature.cells.CellMacro(macroname='cell')¶
Bases:
FLMMacroSpecError
The main cells environment spec¶
- class flm.feature.cells.CellsEnvironment(environmentname='cells')¶
Bases:
FLMEnvironmentSpecBase- 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.
- 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.
- make_body_parser(token, nodeargd, arg_parsing_state_delta)¶
- postprocess_parsed_node(node)¶
- render(node, render_context)¶
Produce a final representation of the node, using the given render_context.
- recompose_pure_latex(node, recomposer)¶
Cells internal model¶
- class flm.feature.cells.CellIndexRangeModel(start, end)¶
Bases:
objectA half-open range of cell indices along one axis (row or column).
Indices use zero-based numbering internally: start is inclusive and end is exclusive (one past the last included index).
- class flm.feature.cells.CellPlacementModel(row_range, col_range)¶
Bases:
objectDescribes the grid placement of a single cell as a row range and a column range, supporting multi-row and multi-column spans.
- class flm.feature.cells.CellModel(placement, styles, content_nodes)¶
Bases:
objectRepresents a single cell within a
cellsenvironment, combining its grid placement, style annotations, and content nodes.
- class flm.feature.cells.CellPlacementsMappingModel(row_placements, col_placements)¶
Bases:
object- get_row_index_range(row_j, current_row=None)¶
- get_col_index_range(col_j, current_col=None)¶
- start_row_col(current_row=None, current_col=None)¶
- class flm.feature.cells.CellsModel(**kwargs)¶
Bases:
objectHolds the complete grid of cells for one
cellsenvironment.Built incrementally during parsing via
add_cell(),add_cell_node(), andadd_celldata_node(), then finalized withfinalize()which populates thegrid_datamatrix used during rendering. Row and column indices are zero-based internally.- add_cell_node(cell_node, default_placement=None, default_styles=None)¶
- add_cell(placement_spec, styles, content_nodes)¶
- move_to_col(col)¶
- move_next_row()¶
- finalize()¶
- add_celldata_node(celldata_node)¶
- add_celldata(placement_mapping_spec, styles_mapping, data_content_nodes)¶
- parse_cell_index_spec(index_spec, is_row=False, is_col=False, default=<class 'flm.feature.cells._NotSpecified'>)¶
- parse_cell_index_range_spec(range_spec_s, is_row=False, is_col=False, default=<class 'flm.feature.cells._NotSpecified'>, default_start=None, default_end=None)¶
- parse_placement_index_spec(placement_index_spec, is_row=False, is_col=False, default=<class 'flm.feature.cells._NotSpecified'>, default_start=0, default_end=<class 'flm.feature.cells._NotSpecified'>)¶
- parse_placement_spec(placement_spec)¶
- parse_placement_mapping_index_spec(placement_mapping_index_spec, index_end, is_row=False, is_col=False)¶
- parse_placement_mapping_spec(placement_mapping_spec)¶
The feature class¶
- class flm.feature.cells.FeatureCells¶
Bases:
FeatureFeature plugin for data tables using the
cellsenvironment. Registers the\begin{cells}...\end{cells}environment which accepts\cell,\celldata, and\mergecommands for flexible table layout. Does not require document- or render-level manager state.- 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()¶
- add_flm_doc_latex_context_definitions(base_feature_definitions)¶
These definitions won’t be used in the real world. This method will only be queried by flm.docgen to generate comprehensive documentation that includes these commands.
- flm.feature.cells.FeatureClass = <class 'flm.feature.cells.FeatureCells'>¶
Feature plugin for data tables using the
cellsenvironment. Registers the\begin{cells}...\end{cells}environment which accepts\cell,\celldata, and\mergecommands for flexible table layout. Does not require document- or render-level manager state.