| 1 |
# -*- coding: utf-8 -*- |
| 2 |
""" |
| 3 |
sphinxcontrib.restbuilder |
| 4 |
========================= |
| 5 |
|
| 6 |
Sphinx extension to output reST files. |
| 7 |
|
| 8 |
.. moduleauthor:: Freek Dijkstra <[email protected]> |
| 9 |
|
| 10 |
:copyright: Copyright 2012-2021 by Freek Dijkstra and contributors. |
| 11 |
:license: BSD, see LICENSE.txt for details. |
| 12 |
""" |
| 13 |
|
| 14 |
from __future__ import (print_function, unicode_literals, absolute_import) |
| 15 |
|
| 16 |
from sphinx.builders import Builder |
| 17 |
from sphinx.writers.text import STDINDENT |
| 18 |
from .builders.rst import RstBuilder |
| 19 |
from .writers.rst import RstWriter |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
def setup(app): |
| 24 |
app.require_sphinx('1.0') |
| 25 |
app.add_builder(RstBuilder) |
| 26 |
app.add_config_value('rst_file_suffix', ".rst", False) |
| 27 |
"""This is the file name suffix for reST files""" |
| 28 |
app.add_config_value('rst_link_suffix', None, False) |
| 29 |
"""The is the suffix used in internal links. By default, takes the same value as rst_file_suffix""" |
| 30 |
app.add_config_value('rst_file_transform', None, False) |
| 31 |
"""Function to translate a docname to a filename. By default, returns docname + rst_file_suffix.""" |
| 32 |
app.add_config_value('rst_link_transform', None, False) |
| 33 |
"""Function to translate a docname to a (partial) URI. By default, returns docname + rst_link_suffix.""" |
| 34 |
app.add_config_value('rst_indent', STDINDENT, False) |