Text¶
Text formatting tags
- class disseminate.tags.text.Body(name, content, attributes, context)¶
Bases:
disseminate.tags.tag.Tag
A body tag for the body of a document.
In (x)html, this is rendered as a <div> instead of the default <span>
- html_fmt(attributes=None, **kwargs)¶
Convert the tag to an html string or html element.
- Parameters
- contentOptional[Union[str, List[Union[str, list,
Tag
]]] Specify an alternative content from the tag’s content. It can either be a string, a tag or a list of strings, tags and lists.
- attributesOptional[Union[str,
Attributes
]] Specify an alternative attributes dict from the tag’s attributes. It can either be a string or an attributes dict.
- format_funcOptional[str]
The format function to use with by formatted_content when formatting sub-tags.
- methodOptional[str]
The rendering method for the string. ex: ‘html’ or ‘xml’
- levelOptional[int]
The level of the tag.
- contentOptional[Union[str, List[Union[str, list,
- Returns
- htmlstr or html element
A string in HTML format or an HTML element (
lxml.builder.E
).
- xhtml_fmt(content=None, attributes=None, format_func='xhtml_fmt', method='xhtml', level=1, **kwargs)¶
Convert the tag to an xhtml string or html element.
- Returns
- xhtmlstr or xhtml element
A string in XHTML format or an XHTML element (
lxml.builder.E
).
- class disseminate.tags.text.Bold(name, content, attributes, context)¶
Bases:
disseminate.tags.tag.Tag
A bold tag.
- Attributes
- aliasesTuple[str]
A list of strs for other names a tag goes by
- html_namestr
If specified, use this name when rendering the tag to html. Otherwise, use name.
- tex_cmdstr
Use this name to render the tex command.
- activebool
This tag is active.
- class disseminate.tags.text.Italics(name, content, attributes, context)¶
Bases:
disseminate.tags.tag.Tag
An italics tag.
- Attributes
- aliasesTuple[str]
A list of strs for other names a tag goes by
- html_namestr
If specified, use this name when rendering the tag to html. Otherwise, use name.
- tex_cmdstr
Use this name to render the tex command.
- activebool
This tag is active.
- class disseminate.tags.text.P(name, content, attributes, context)¶
Bases:
disseminate.tags.tag.Tag
A Paragraph tag
- Attributes
- activebool
This tag is active.
- include_paragraphsbool
The contents of this tag can be included in paragraphs.
- tex_fmt(**kwargs)¶
Format the tag in LaTeX format.
- Parameters
- contentOptional[Union[str, List[Union[str, list,
Tag
]]] Specify an alternative content from the tag’s content. It can either be a string, a tag or a list of strings, tags and lists.
- attributesOptional[Union[str,
Attributes
]] Specify an alternative attributes dict from the tag’s attributes. It can either be a string or an attributes dict.
- mathmodeOptional[bool]
If True, the tag will be rendered in math mode. Otherwise (default) latex text mode is assumed.
- levelOptional[int]
The level of the tag.
- contentOptional[Union[str, List[Union[str, list,
- Returns
- tex_stringstr
The formatted tex string.
- class disseminate.tags.text.Sub(name, content, attributes, context)¶
Bases:
disseminate.tags.tag.Tag
A subscript tag.
- Attributes
- html_namestr
If specified, use this name when rendering the tag to html. Otherwise, use name.
- activebool
This tag is active.
- tex_fmt(content=None, attributes=None, mathmode=False, level=1, **kwargs)¶
Format the tag in LaTeX format.
- Parameters
- contentOptional[Union[str, List[Union[str, list,
Tag
]]] Specify an alternative content from the tag’s content. It can either be a string, a tag or a list of strings, tags and lists.
- attributesOptional[Union[str,
Attributes
]] Specify an alternative attributes dict from the tag’s attributes. It can either be a string or an attributes dict.
- mathmodeOptional[bool]
If True, the tag will be rendered in math mode. Otherwise (default) latex text mode is assumed.
- levelOptional[int]
The level of the tag.
- contentOptional[Union[str, List[Union[str, list,
- Returns
- tex_stringstr
The formatted tex string.
- class disseminate.tags.text.Sup(name, content, attributes, context)¶
Bases:
disseminate.tags.tag.Tag
A superscript tag.
- Attributes
- html_namestr
If specified, use this name when rendering the tag to html. Otherwise, use name.
- activebool
This tag is active.
- tex_fmt(content=None, attributes=None, mathmode=False, level=1, **kwargs)¶
Format the tag in LaTeX format.
- Parameters
- contentOptional[Union[str, List[Union[str, list,
Tag
]]] Specify an alternative content from the tag’s content. It can either be a string, a tag or a list of strings, tags and lists.
- attributesOptional[Union[str,
Attributes
]] Specify an alternative attributes dict from the tag’s attributes. It can either be a string or an attributes dict.
- mathmodeOptional[bool]
If True, the tag will be rendered in math mode. Otherwise (default) latex text mode is assumed.
- levelOptional[int]
The level of the tag.
- contentOptional[Union[str, List[Union[str, list,
- Returns
- tex_stringstr
The formatted tex string.
- class disseminate.tags.text.Supsub(*args, **kwargs)¶
Bases:
disseminate.tags.tag.Tag
A superscript/subscript tag, together, that displays them one on top of the other.
The content of the tag consists of two elements separated by a ‘&&’ character. ex: @supsub{superscript && subscript}
- Attributes
- activebool
This tag is active.
- html_fmt(content=None, attributes=None, format_func='html_fmt', method='html', level=1, **kwargs)¶
Convert the tag to an html string or html element.
- Parameters
- contentOptional[Union[str, List[Union[str, list,
Tag
]]] Specify an alternative content from the tag’s content. It can either be a string, a tag or a list of strings, tags and lists.
- attributesOptional[Union[str,
Attributes
]] Specify an alternative attributes dict from the tag’s attributes. It can either be a string or an attributes dict.
- format_funcOptional[str]
The format function to use with by formatted_content when formatting sub-tags.
- methodOptional[str]
The rendering method for the string. ex: ‘html’ or ‘xml’
- levelOptional[int]
The level of the tag.
- contentOptional[Union[str, List[Union[str, list,
- Returns
- htmlstr or html element
A string in HTML format or an HTML element (
lxml.builder.E
).
- tex_fmt(content=None, attributes=None, mathmode=False, level=1, **kwargs)¶
Format the tag in LaTeX format.
- Parameters
- contentOptional[Union[str, List[Union[str, list,
Tag
]]] Specify an alternative content from the tag’s content. It can either be a string, a tag or a list of strings, tags and lists.
- attributesOptional[Union[str,
Attributes
]] Specify an alternative attributes dict from the tag’s attributes. It can either be a string or an attributes dict.
- mathmodeOptional[bool]
If True, the tag will be rendered in math mode. Otherwise (default) latex text mode is assumed.
- levelOptional[int]
The level of the tag.
- contentOptional[Union[str, List[Union[str, list,
- Returns
- tex_stringstr
The formatted tex string.
- class disseminate.tags.text.Symbol(name, content, attributes, context)¶
Bases:
disseminate.tags.tag.Tag
One or more greek characters.
- Attributes
- aliasesTuple[str]
A list of strs for other names a tag goes by
- activebool, default: True
This tag is active.
- html_fmt(content=None, attributes=None, method='html', level=1, **kwargs)¶
Convert the tag to an html string or html element.
- Parameters
- contentOptional[Union[str, List[Union[str, list,
Tag
]]] Specify an alternative content from the tag’s content. It can either be a string, a tag or a list of strings, tags and lists.
- attributesOptional[Union[str,
Attributes
]] Specify an alternative attributes dict from the tag’s attributes. It can either be a string or an attributes dict.
- format_funcOptional[str]
The format function to use with by formatted_content when formatting sub-tags.
- methodOptional[str]
The rendering method for the string. ex: ‘html’ or ‘xml’
- levelOptional[int]
The level of the tag.
- contentOptional[Union[str, List[Union[str, list,
- Returns
- htmlstr or html element
A string in HTML format or an HTML element (
lxml.builder.E
).
- tex_fmt(content=None, attributes=None, mathmode=False, level=1, **kwargs)¶
Format the tag in LaTeX format.
- Parameters
- contentOptional[Union[str, List[Union[str, list,
Tag
]]] Specify an alternative content from the tag’s content. It can either be a string, a tag or a list of strings, tags and lists.
- attributesOptional[Union[str,
Attributes
]] Specify an alternative attributes dict from the tag’s attributes. It can either be a string or an attributes dict.
- mathmodeOptional[bool]
If True, the tag will be rendered in math mode. Otherwise (default) latex text mode is assumed.
- levelOptional[int]
The level of the tag.
- contentOptional[Union[str, List[Union[str, list,
- Returns
- tex_stringstr
The formatted tex string.
- xhtml_fmt(content=None, attributes=None, method='xml', level=1, **kwargs)¶
Convert the tag to an xhtml string or html element.
- Returns
- xhtmlstr or xhtml element
A string in XHTML format or an XHTML element (
lxml.builder.E
).
- class disseminate.tags.text.Verb(name, content, attributes, context)¶
Bases:
disseminate.tags.tag.Tag
A verbatim tag for displaying unformatted blocks of text.
- Attributes
- aliasesTuple[str]
A list of strs for other names a tag goes by
- html_namestr
If specified, use this name when rendering the tag to html. Otherwise, use name.
- activebool
This tag is active.
- process_contentbool
Do not process the contents of the tag–just take the contents literally.
- include_paragraphsbool
The contents of this tag cannot be included in paragraphs.
- html_fmt(attributes=None, *args, **kwargs)¶
Convert the tag to an html string or html element.
- Parameters
- contentOptional[Union[str, List[Union[str, list,
Tag
]]] Specify an alternative content from the tag’s content. It can either be a string, a tag or a list of strings, tags and lists.
- attributesOptional[Union[str,
Attributes
]] Specify an alternative attributes dict from the tag’s attributes. It can either be a string or an attributes dict.
- format_funcOptional[str]
The format function to use with by formatted_content when formatting sub-tags.
- methodOptional[str]
The rendering method for the string. ex: ‘html’ or ‘xml’
- levelOptional[int]
The level of the tag.
- contentOptional[Union[str, List[Union[str, list,
- Returns
- htmlstr or html element
A string in HTML format or an HTML element (
lxml.builder.E
).
- tex_fmt(*args, **kwargs)¶
Format the tag in LaTeX format.
- Parameters
- contentOptional[Union[str, List[Union[str, list,
Tag
]]] Specify an alternative content from the tag’s content. It can either be a string, a tag or a list of strings, tags and lists.
- attributesOptional[Union[str,
Attributes
]] Specify an alternative attributes dict from the tag’s attributes. It can either be a string or an attributes dict.
- mathmodeOptional[bool]
If True, the tag will be rendered in math mode. Otherwise (default) latex text mode is assumed.
- levelOptional[int]
The level of the tag.
- contentOptional[Union[str, List[Union[str, list,
- Returns
- tex_stringstr
The formatted tex string.