Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def setup(app):
app.add_config_value('recommonmark_config', {
'url_resolver': lambda url: github_doc_root + url,
'auto_toc_tree_section': 'Contents',
}, True)
app.add_transform(AutoStructify)
def setup(app):
app.add_config_value('recommonmark_config', {
'url_resolver': lambda url: github_doc_root + url,
'auto_toc_tree_section': 'Contents',
}, True)
app.add_transform(AutoStructify)
try:
from docutils_tinyhtml import Writer as TinyWriter
except ImportError:
TinyWriter = None
try:
from docutils_html5 import Writer as Html5Writer
except ImportError:
Html5Writer = None
try:
from recommonmark.parser import CommonMarkParser
from recommonmark.transform import AutoStructify, DummyStateMachine
class StringStructify(AutoStructify):
"""Support AutoStructify for publish_string function."""
def apply(self):
"""Apply the transformation by configuration."""
file_name = self.document.settings.file_name
self.url_resolver = self.config['url_resolver']
assert callable(self.url_resolver)
self.state_machine = DummyStateMachine()
self.current_level = 0
self.file_dir = abspath(dirname(file_name))
self.root_dir = self.file_dir
self.traverse(self.document)
class ExtendCommonMarkParser(CommonMarkParser):
"""CommonMarkParser with working AutoStructify."""
def setup(app):
app.add_config_value('recommonmark_config', {
'auto_toc_tree_section': 'Contents',
}, True)
app.add_transform(AutoStructify)
app.connect('builder-inited', run_copyreadme)
app.connect('builder-inited', run_apidoc)
def setup(app):
app.add_config_value('recommonmark_config', {
'auto_toc_tree_section': 'Contents',
}, True)
app.add_transform(AutoStructify)
def setup(app):
app.add_config_value('recommonmark_config', {
'auto_toc_tree_section': 'Contents'}, True)
app.add_transform(AutoStructify)
def setup(app):
config = {
# 'url_resolver': lambda url: github_doc_root + url,
'auto_toc_tree_section': 'Contents',
'enable_eval_rst': True,
}
app.add_config_value('recommonmark_config', config, True)
app.add_transform(AutoStructify)
def setup(app):
app.add_config_value(
'recommonmark_config',
{'enable_auto_toc_tree': True, 'auto_toc_tree_section': 'Contents'},
True,
)
app.add_transform(AutoStructify)
def setup(app):
# Add hook for building doxygen xml when needed
# no c++ API for now
app.connect("builder-inited", generate_doxygen_xml)
app.add_config_value('recommonmark_config', {
'url_resolver': lambda url: github_doc_root + url,
'auto_doc_ref': True
}, True)
app.add_transform(AutoStructify)
def setup(app):
app.add_config_value('recommonmark_config', {
'url_resolver': lambda url: github_doc_root + url,
'auto_toc_tree_section': 'Contents',
}, True)
app.add_transform(AutoStructify)