module documentation
ZMSTextformat.py - Text-format model and rendering helpers for ZMS rich-text output.
Text-format model and rendering helpers for ZMS rich-text output.
This module contains:
- br_quote: a helper that transforms plain text into HTML fragments while preserving line breaks, indentation, and simple nested list markers.
- ZMSTextformat: a small value object representing one configured text format (tag, optional sub-tag, attributes, and usage metadata), plus rendering helpers to convert input text into wrapped HTML.
License: GNU General Public License v2 or later, Organization: ZMS Publishing
| Class | |
Represent one text-format definition and provide rendering helpers. |
| Function | br |
Convert a plain text fragment to HTML according to the configured sub-tag. |
Convert a plain text fragment to HTML according to the configured sub-tag.
The function preserves leading whitespace, supports <br> handling, injects management-interface markers for visible line breaks, and converts simple tab-prefixed list syntax ' * '/' #' into nested '<ul>'/'<ol>' structures.
| Parameters | |
| self:object | Rendering context used to detect management interface mode. |
| text:str | Input text to transform. |
| subtag:str | Optional sub-tag name used for line wrapping (e.g. 'br'). |
| Returns | |
| str | HTML fragment with transformed line and list markup. |