File: local_extension.py

package info (click to toggle)
python-pyproject-parser 0.13.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,432 kB
  • sloc: python: 3,086; makefile: 7
file content (24 lines) | stat: -rw-r--r-- 580 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# 3rd party
from docutils import nodes
from sphinx.util.docutils import SphinxDirective


def configure(app, doctree):
	if app.builder.name.lower() == "html":
		app.config.toctree_plus_types.add("method")
		app.config.toctree_plus_types.add("attribute")


class Space(SphinxDirective):

	def run(self):
		# TODO: other builders
		return [
				nodes.raw('', "\n\\vspace{10px}\n", format="latex"),
				nodes.raw('', "\n</br>\n", format="html"),  # nodes.line_block('', nodes.line())
				]


def setup(app):
	app.connect("doctree-read", configure)
	app.add_directive("space", Space)