Caption¶
Tags for figure captions and references.
- class disseminate.tags.caption.Caption(*args, **kwargs)¶
Bases:
disseminate.tags.tag.Tag
,disseminate.tags.label.LabelMixin
A tag for captions.
Note
The use of a naked caption tag is allowed (i.e. a caption not nested within a figure or table), but this won’t register a label with the label manager. In order to create a label, the create_label method in the LabelMixin must be invoked.
- example
@fig{@img{image.svg} @caption{My first figure} }
- default_fmt(attributes=None, content=None)¶
Convert the tag to a text string.
Strips the tag information and simply return the content of the tag.
- 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.
- contentOptional[Union[str, List[Union[str, list,
- Returns
- text_stringstr
A text string with the tags stripped.
- generate_label_id()¶
Generate the label id and set the id in the attributes.
- generate_label_kind()¶
Generate the kind tuple for the created label.
Override this function to customize the generation of the label kind.
- Returns
- kindTuple[str]
A tuple of strings for the kind of label. ex: (‘heading’, ‘chapter’)
- html_fmt(content=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
).
- tex_fmt(content=None, attributes=None, mathmode=False, level=1)¶
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.
- exception disseminate.tags.caption.CaptionError¶
Bases:
Exception
An error was encountered in processing a caption.