base

RestructuredText Object abstraction.

class rstobj.base.RstObj[source]

The base restructured text object.

property template_name: str

Find template file.

Return type

str

property template: Template

Return jinja2.Template instance.

Return type

str

render(indent: Optional[int] = None, first_line_indent: Optional[int] = None, **kwargs) str[source]

Render this object into text.

Parameters
  • indent – global indent. Indent length can be changed in rstobj.option.Options.tab.

  • first_line_indent – sometimes we only need to indent first line, this option will overwrite the indent argument.

  • kwargs – other optional arguments.

static str_or_render(value: Union[str, rstobj.base.RstObj], **kwargs)[source]

If it is a string type, then just return. If it is a RstObj type, then return the rendered string.

Return type

str