class documentation

class ZMSTextformat(object): (source)

Constructor: ZMSTextformat(id, ob, manage_lang)

View In Hierarchy

Represent one text-format definition and provide rendering helpers.

A text format defines the outer tag, optional inner sub-tag, additional HTML attributes, editor-availability flag, and usage categories.

Method __init__ Initialize the text-format object from its persisted configuration mapping.
Method getAttrs Return the raw HTML attribute string for the outer tag.
Method getDisplay Return the management label shown for this text format.
Method getEndTag Return the closing HTML tag for the configured outer tag.
Method getHtml Return a management-preview HTML snippet for this text format.
Method getId Return the text-format identifier.
Method getRichedit Return whether this format is available in rich-text editing.
Method getStartTag Build the opening HTML tag for this text format.
Method getSubTag Return the optional sub-tag used for line-level wrapping.
Method getTag Return the outer HTML tag used for rendering.
Method getUsage Return the usage categories where this format is offered.
Method parseAttrs Parse the raw attribute string into (name, value) tuples.
Method renderText Render input text according to this text format definition.
Method setAttrs Set the raw HTML attribute string for the outer tag.
Method setDisplay Set the management label shown for this text format.
Method setId Set the text-format identifier.
Method setRichedit Set the rich-text-editor availability flag.
Method setSubTag Set the optional sub-tag used for line-level wrapping.
Method setTag Set the outer HTML tag used for rendering.
Method setUsage Set the usage categories where this format is offered.
Class Variable getAttrs__roles__ Undocumented
Class Variable getDisplay__roles__ Undocumented
Class Variable getEndTag__roles__ Undocumented
Class Variable getHtml__roles__ Undocumented
Class Variable getId__roles__ Undocumented
Class Variable getRichedit__roles__ Undocumented
Class Variable getStartTag__roles__ Undocumented
Class Variable getSubTag__roles__ Undocumented
Class Variable getTag__roles__ Undocumented
Class Variable getUsage__roles__ Undocumented
Class Variable parseAttrs__roles__ Undocumented
Class Variable renderText__roles__ Undocumented
Instance Variable attrs Undocumented
Instance Variable display Undocumented
Instance Variable id Undocumented
Instance Variable richedit Undocumented
Instance Variable subtag Undocumented
Instance Variable tag Undocumented
Instance Variable usage Undocumented
def __init__(self, id, ob, manage_lang): (source)

Initialize the text-format object from its persisted configuration mapping.

Parameters
id:strText-format identifier.
ob:dictPersisted format definition containing keys like display, tag, subtag, attrs, optional richedit, and optional usage.
manage_lang:strLanguage used to select the display label.
def getAttrs(self): (source)

Return the raw HTML attribute string for the outer tag.

def getDisplay(self): (source)

Return the management label shown for this text format.

def getEndTag(self): (source)

Return the closing HTML tag for the configured outer tag.

def getHtml(self): (source)

Return a management-preview HTML snippet for this text format.

Returns
strHTML preview showing opening tag, sample content, and closing tag.
def getId(self): (source)

Return the text-format identifier.

def getRichedit(self): (source)

Return whether this format is available in rich-text editing.

def getStartTag(self, id=None, clazz=None): (source)

Build the opening HTML tag for this text format.

Parameters
id:str or NoneOptional DOM id attribute for the opening tag.
clazz:str or NoneOptional CSS class attribute for the opening tag.
Returns
strOpening tag HTML or an empty string when no outer tag is defined.
def getSubTag(self): (source)

Return the optional sub-tag used for line-level wrapping.

def getTag(self): (source)

Return the outer HTML tag used for rendering.

def getUsage(self): (source)

Return the usage categories where this format is offered.

def parseAttrs(self): (source)

Parse the raw attribute string into (name, value) tuples.

Returns
listList of parsed attribute-name/value tuples.
def renderText(self, context, text, id=None, clazz=None, encoding='utf-8', errors='strict'): (source)

Render input text according to this text format definition.

The method wraps transformed text with opening/closing tags generated by this format. Line handling is delegated to br_quote.

Parameters
context:objectRendering context passed to br_quote.
text:str or bytesInput text or bytes to render.
id:str or NoneOptional DOM id for the opening tag.
clazz:str or NoneOptional CSS class for the opening tag.
encoding:strCharacter encoding used when decoding byte strings.
errors:strError handling mode for byte decoding.
Returns
strRendered HTML fragment.
def setAttrs(self, attrs): (source)

Set the raw HTML attribute string for the outer tag.

def setDisplay(self, display): (source)

Set the management label shown for this text format.

def setId(self, id): (source)

Set the text-format identifier.

def setRichedit(self, richedit): (source)

Set the rich-text-editor availability flag.

Non-empty string/bytes values are normalized to 1 for compatibility with historic persisted values.

def setSubTag(self, subtag): (source)

Set the optional sub-tag used for line-level wrapping.

def setTag(self, tag): (source)

Set the outer HTML tag used for rendering.

def setUsage(self, usage): (source)

Set the usage categories where this format is offered.

getAttrs__roles__ = (source)

Undocumented

getDisplay__roles__ = (source)

Undocumented

getEndTag__roles__ = (source)

Undocumented

getHtml__roles__ = (source)

Undocumented

getId__roles__ = (source)

Undocumented

getRichedit__roles__ = (source)

Undocumented

getStartTag__roles__ = (source)

Undocumented

getSubTag__roles__ = (source)

Undocumented

getTag__roles__ = (source)

Undocumented

getUsage__roles__ = (source)

Undocumented

parseAttrs__roles__ = (source)

Undocumented

renderText__roles__ = (source)

Undocumented

Undocumented

Undocumented

Undocumented

richedit = (source)

Undocumented

Undocumented

Undocumented

Undocumented