lib.publisher

Docutils Publisher fors for Django Docutils.

django_docutils.lib.publisher.publish_parts_from_doctree(document, destination_path=None, writer=None, writer_name='pseudoxml', settings=None, settings_spec=None, settings_overrides=None, config_section=None, enable_exit_status=False)[source]

Render docutils doctree into docutils parts.

Return type:

Dict[str, str]

django_docutils.lib.publisher.publish_toc_from_doctree(doctree, writer=None)[source]

Publish table of contents from docutils doctree.

Return type:

Optional[str]

django_docutils.lib.publisher.publish_doctree(source, settings_overrides={})[source]

Split off ability to get doctree (a.k.a. document).

It’s valuable to be able to run transforms to alter and most importantly, extract data like post abstracts.

Parameters:
  • source (str or bytes) – RST content

  • settings_overrides (dict) – Settings overrides for docutils

Returns:

document/doctree for reStructuredText content

Return type:

docutils.nodes.document

django_docutils.lib.publisher.publish_html_from_source(source, **kwargs)[source]

Return HTML from reStructuredText source string.

Return type:

Optional[str]

django_docutils.lib.publisher.publish_html_from_doctree(doctree, show_title=True, toc_only=False)[source]

Return HTML from reStructuredText document (doctree).

Parameters:
  • value (str) – Contents from template being placed into node

  • show_title (bool) – Show top level title

  • toc_only (bool) – Special flag: return show TOC, used for sidebars

Returns:

HTML from reStructuredText document (doctree)

Return type:

str or None