Merge branch '12.0-one-doc-edi' of github.com:odoo/documentation-user into 12.0-one-doc-edi
This commit is contained in:
commit
8beab6ba56
3
Makefile
3
Makefile
@ -5,7 +5,8 @@ CONFIG_DIR = .
|
|||||||
SPHINXOPTS = -D project_root=$(ROOT) -D canonical_version=$(CANONICAL_VERSION) \
|
SPHINXOPTS = -D project_root=$(ROOT) -D canonical_version=$(CANONICAL_VERSION) \
|
||||||
-D versions=$(VERSIONS) -D languages=$(LANGUAGES) -D language=$(CURRENT_LANG) \
|
-D versions=$(VERSIONS) -D languages=$(LANGUAGES) -D language=$(CURRENT_LANG) \
|
||||||
-D is_remote_build=$(IS_REMOTE_BUILD) \
|
-D is_remote_build=$(IS_REMOTE_BUILD) \
|
||||||
-A google_analytics_key=$(GOOGLE_ANALYTICS_KEY)
|
-A google_analytics_key=$(GOOGLE_ANALYTICS_KEY) \
|
||||||
|
-j auto
|
||||||
SOURCE_DIR = content
|
SOURCE_DIR = content
|
||||||
BUILD_DIR = _build
|
BUILD_DIR = _build
|
||||||
|
|
||||||
|
5
conf.py
5
conf.py
@ -164,9 +164,10 @@ html_favicon = os.path.join(html_theme_path[0], html_theme, 'static', 'img', 'fa
|
|||||||
html_static_path = ['static']
|
html_static_path = ['static']
|
||||||
html_add_permalinks = '¶' # Sphinx < 3.5
|
html_add_permalinks = '¶' # Sphinx < 3.5
|
||||||
html_permalinks = True # Sphinx >= 3.5
|
html_permalinks = True # Sphinx >= 3.5
|
||||||
# The page-specific js files that can be imported with the 'custom-js' metadata directive. TODO VFE does it act as a filter? Why are there already some imports not listed here?
|
# Additional css & js files:
|
||||||
|
# Empty because the js & css files are specified in the extensions/theme
|
||||||
|
# or specified for a given page only through the custom-js & custom-css metadata directives
|
||||||
html_js_files = []
|
html_js_files = []
|
||||||
# The page-specific css files that can be imported with the 'custom-css' metadata directive. TODO VFE does it act as a filter? Why are there already some imports not listed here?
|
|
||||||
html_css_files = []
|
html_css_files = []
|
||||||
|
|
||||||
# PHP lexer option to not require <?php
|
# PHP lexer option to not require <?php
|
||||||
|
@ -19,3 +19,8 @@ def setup(app):
|
|||||||
directives.register_directive('autodata', PlaceHolder)
|
directives.register_directive('autodata', PlaceHolder)
|
||||||
directives.register_directive('automethod', PlaceHolder)
|
directives.register_directive('automethod', PlaceHolder)
|
||||||
directives.register_directive('autoattribute', PlaceHolder)
|
directives.register_directive('autoattribute', PlaceHolder)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'parallel_read_safe': True,
|
||||||
|
'parallel_write_safe': True
|
||||||
|
}
|
||||||
|
@ -61,6 +61,11 @@ class Vimeo(IframeVideo):
|
|||||||
class="align-%(align)s"></iframe>'
|
class="align-%(align)s"></iframe>'
|
||||||
|
|
||||||
|
|
||||||
def setup(builder):
|
def setup(app):
|
||||||
directives.register_directive('youtube', Youtube)
|
directives.register_directive('youtube', Youtube)
|
||||||
directives.register_directive('vimeo', Vimeo)
|
directives.register_directive('vimeo', Vimeo)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'parallel_read_safe': True,
|
||||||
|
'parallel_write_safe': True
|
||||||
|
}
|
||||||
|
@ -20,5 +20,9 @@ def setup(app):
|
|||||||
lambda self, node: self.depart_admonition(node),
|
lambda self, node: self.depart_admonition(node),
|
||||||
))
|
))
|
||||||
|
|
||||||
|
return {
|
||||||
|
'parallel_read_safe': True,
|
||||||
|
'parallel_write_safe': True
|
||||||
|
}
|
||||||
|
|
||||||
admonitionlabels['exercise'] = 'Exercise'
|
admonitionlabels['exercise'] = 'Exercise'
|
||||||
|
@ -74,6 +74,10 @@ def setup(app):
|
|||||||
odoo_repository=True)
|
odoo_repository=True)
|
||||||
app.config.linkcode_resolve = linkcode_resolve
|
app.config.linkcode_resolve = linkcode_resolve
|
||||||
|
|
||||||
|
return {
|
||||||
|
'parallel_read_safe': True,
|
||||||
|
'parallel_write_safe': True
|
||||||
|
}
|
||||||
|
|
||||||
def make_github_link(app, path, line=None, mode="blob", odoo_repository=False):
|
def make_github_link(app, path, line=None, mode="blob", odoo_repository=False):
|
||||||
config = app.config
|
config = app.config
|
||||||
@ -110,9 +114,5 @@ def add_doc_link(app, pagename, templatename, context, doctree):
|
|||||||
# may be useful in the future
|
# may be useful in the future
|
||||||
source_suffix = app.config.source_suffix
|
source_suffix = app.config.source_suffix
|
||||||
source_suffix = next(iter(source_suffix))
|
source_suffix = next(iter(source_suffix))
|
||||||
# FIXME: odoo/odoo has a doc/ prefix which is incorrect for this
|
|
||||||
# project, how to unify? Add new setting?
|
|
||||||
# FIXME ANVFE: use a config directive to specify the content folder
|
|
||||||
# instead of hardcoding it here ?
|
|
||||||
context['github_link'] = lambda mode='edit': make_github_link(
|
context['github_link'] = lambda mode='edit': make_github_link(
|
||||||
app, 'content/%s%s' % (pagename, source_suffix), mode=mode)
|
app, 'content/%s%s' % (pagename, source_suffix), mode=mode)
|
||||||
|
@ -39,6 +39,10 @@ def setup(app):
|
|||||||
('kbd', kbd), ('var', var), ('samp', samp)]:
|
('kbd', kbd), ('var', var), ('samp', samp)]:
|
||||||
addnode(app, node, name)
|
addnode(app, node, name)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'parallel_read_safe': True,
|
||||||
|
'parallel_write_safe': True
|
||||||
|
}
|
||||||
|
|
||||||
class div(nodes.General, nodes.Element):
|
class div(nodes.General, nodes.Element):
|
||||||
pass
|
pass
|
||||||
|
@ -15,6 +15,10 @@ def setup(app):
|
|||||||
app.add_js_file('js/menu.js')
|
app.add_js_file('js/menu.js')
|
||||||
app.add_js_file('js/page_toc.js')
|
app.add_js_file('js/page_toc.js')
|
||||||
|
|
||||||
|
return {
|
||||||
|
'parallel_read_safe': True,
|
||||||
|
'parallel_write_safe': True
|
||||||
|
}
|
||||||
|
|
||||||
def set_missing_meta(app, pagename, templatename, context, doctree):
|
def set_missing_meta(app, pagename, templatename, context, doctree):
|
||||||
if context.get('meta') is None: # Pages without title (used with `include::`) have no meta
|
if context.get('meta') is None: # Pages without title (used with `include::`) have no meta
|
||||||
|
@ -3,17 +3,18 @@
|
|||||||
|
|
||||||
{% block css %}
|
{% block css %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
{# Allow custom css style import for specific pages #}
|
{% if 'custom-css' in meta %}{# Allow custom css style import for specific pages #}
|
||||||
{% if 'custom-css' in meta %}
|
{% set css_files = meta['custom-css'].split(',') %}
|
||||||
{# TODO VFE this should be wrapped in a loop as custom-css is a comma(, not ;)-separated list #}
|
{% for css_file in css_files %}
|
||||||
{% set link = '_static/css/' + meta['custom-css'] %}
|
{% set link = '_static/css/' + css_file %}
|
||||||
<link rel="stylesheet" href="{{ pathto(link, 1) }}" type="text/css"/>
|
<link rel="stylesheet" href="{{ pathto(link, 1) }}" type="text/css"/>
|
||||||
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
{% if 'custom-js' in meta %}
|
{% if 'custom-js' in meta %}{# Allow custom js import for specific pages #}
|
||||||
{# Before the custom files using React & Immutable #}
|
{# Before the custom files using React & Immutable (accounting mementos) #}
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/immutable/3.8.2/immutable.min.js"
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/immutable/3.8.2/immutable.min.js"
|
||||||
integrity="sha512-myCdDiGJRYrvRb/VuJ67ljifYTJdc1jdEvL4c4ftX9o3N6EAnmD83c/7l2/91RCINZ7c8w21tiXDT7RDFjdc3g=="
|
integrity="sha512-myCdDiGJRYrvRb/VuJ67ljifYTJdc1jdEvL4c4ftX9o3N6EAnmD83c/7l2/91RCINZ7c8w21tiXDT7RDFjdc3g=="
|
||||||
crossorigin="anonymous"></script>
|
crossorigin="anonymous"></script>
|
||||||
@ -27,13 +28,10 @@
|
|||||||
<script src="{{ pathto(link, 1) }}"></script>
|
<script src="{{ pathto(link, 1) }}"></script>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{# FIXME ANVFEDI Do we really need prefixfree ? It triggers a reload of css files two more times/page #}
|
{{ super() }} {# Load the scripts specified in the extensions/themes #}
|
||||||
<!-- <script src="https://cdn.jsdelivr.net/npm/prefixfree@1.0.0/prefixfree.min.js"
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/js/bootstrap.bundle.min.js"
|
||||||
integrity="sha256-a1jYldRqTzpGqk63nmXXjh/zPYp7Sjxp9iUYhNbYPXI="
|
integrity="sha384-b5kHyXgcpbZJO/tY9Ul7kGkf1S0CWuKcCD38l8YkeH8z8QjE0GmW1gYU5S9FOnJ0"
|
||||||
crossorigin="anonymous"></script> -->
|
crossorigin="anonymous"></script>
|
||||||
{{ super() }}
|
|
||||||
{# TODO EDI boostrap beta cdn ??? Isn't there a stable CDN ? It looks like this cdn won't exist forever :D #}
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/js/bootstrap.bundle.min.js" integrity="sha384-b5kHyXgcpbZJO/tY9Ul7kGkf1S0CWuKcCD38l8YkeH8z8QjE0GmW1gYU5S9FOnJ0" crossorigin="anonymous"></script>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block linktags %}
|
{% block linktags %}
|
||||||
@ -55,12 +53,12 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block header %}
|
{% block header %}
|
||||||
{# shown when js has properly set all the classes on the toc elements #}
|
|
||||||
<noscript>
|
<noscript>
|
||||||
<nav class="o_side_nav border-end">
|
<nav class="o_side_nav border-end">
|
||||||
{% include "layout_templates/menu.html" %}
|
{% include "layout_templates/menu.html" %}
|
||||||
</nav>
|
</nav>
|
||||||
</noscript>
|
</noscript>
|
||||||
|
{# shown when js has properly set all the classes on the toc elements #}
|
||||||
<nav id="o_main_toctree" class="o_side_nav border-end" hidden>
|
<nav id="o_main_toctree" class="o_side_nav border-end" hidden>
|
||||||
{% include "layout_templates/menu.html" %}
|
{% include "layout_templates/menu.html" %}
|
||||||
</nav>
|
</nav>
|
||||||
@ -103,11 +101,9 @@
|
|||||||
{% include "layout_templates/homepage.html" %}
|
{% include "layout_templates/homepage.html" %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<article id="o_content" class="doc-body">
|
<article id="o_content" class="doc-body">
|
||||||
<!-- Beacon used by the Sphinx search to know where to look for a string -->
|
<div role="main">{# Beacon used by the Sphinx search to know where to look for a string #}
|
||||||
<div role="main">
|
|
||||||
{% block body %} {% endblock %}
|
{% block body %} {% endblock %}
|
||||||
</div>
|
</div>
|
||||||
{# Do not show the edition link for pages without content #}
|
|
||||||
{% if github_link and pagename != 'search' %}
|
{% if github_link and pagename != 'search' %}
|
||||||
<a href="{{ github_link(mode='edit') }}" class="o_git_link d-none d-lg-inline-block"><i class="i-edit"></i> Edit on GitHub</a>
|
<a href="{{ github_link(mode='edit') }}" class="o_git_link d-none d-lg-inline-block"><i class="i-edit"></i> Edit on GitHub</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
let tocEntryListId = 0; // Used to generate IDs of toc entry lists for both the menu and page TOC
|
let tocEntryListId = 0; // Used to generate IDs of toc entry lists for both the menu and page TOC
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the provided TOC to allow collapsing its entries with Bootstrap's accordion.
|
* Update the provided TOC to allow collapsing its entries with Bootstrap's accordion.
|
||||||
@ -42,7 +42,7 @@ const _prepareAccordion = (tocElement) => {
|
|||||||
const tocRoot = tocElement.querySelector('ul');
|
const tocRoot = tocElement.querySelector('ul');
|
||||||
tocRoot.querySelectorAll('ul').forEach(tocEntryList => {
|
tocRoot.querySelectorAll('ul').forEach(tocEntryList => {
|
||||||
// Modify the <ul> element
|
// Modify the <ul> element
|
||||||
tocEntryList.id = `o_target_${tocEntryListId++}`
|
tocEntryList.id = `o_target_${tocEntryListId++}`;
|
||||||
tocEntryList.classList.add('collapse');
|
tocEntryList.classList.add('collapse');
|
||||||
// Create and configure an <i> element
|
// Create and configure an <i> element
|
||||||
const arrowButton = document.createElement('I');
|
const arrowButton = document.createElement('I');
|
||||||
|
@ -76,9 +76,6 @@ class BootstrapTranslator(HTML5Translator):
|
|||||||
self.context = []
|
self.context = []
|
||||||
self.section_level = 0
|
self.section_level = 0
|
||||||
|
|
||||||
# self.config = self.builder.config
|
|
||||||
# self.highlightlang = self.highlightlang_base = self.builder.config.highlight_language
|
|
||||||
|
|
||||||
self.first_param = 1
|
self.first_param = 1
|
||||||
self.param_separator = ','
|
self.param_separator = ','
|
||||||
|
|
||||||
@ -91,32 +88,17 @@ class BootstrapTranslator(HTML5Translator):
|
|||||||
0xa0: u' '
|
0xa0: u' '
|
||||||
})
|
})
|
||||||
|
|
||||||
# def add_meta(self, meta):
|
|
||||||
# self.meta.append('\n ' + meta)
|
|
||||||
|
|
||||||
# only "space characters" SPACE, CHARACTER TABULATION, LINE FEED,
|
|
||||||
# FORM FEED and CARRIAGE RETURN should be collapsed, not al White_Space
|
|
||||||
|
|
||||||
|
|
||||||
def unknown_visit(self, node):
|
def unknown_visit(self, node):
|
||||||
print("unknown node", node.__class__.__name__)
|
print("unknown node", node.__class__.__name__)
|
||||||
self.body.append(u'[UNKNOWN NODE {}]'.format(node.__class__.__name__))
|
self.body.append(u'[UNKNOWN NODE {}]'.format(node.__class__.__name__))
|
||||||
raise nodes.SkipNode
|
raise nodes.SkipNode
|
||||||
|
|
||||||
# VFE NOTE: seems that when we remove/comment this, we get 5 times the tiles in the global toc :D
|
# VFE NOTE: seems that when we remove/comment this, we get the titles 5 timesin the global toc :D
|
||||||
def visit_document(self, node):
|
def visit_document(self, node):
|
||||||
self.first_title = True
|
self.first_title = True
|
||||||
def depart_document(self, node):
|
def depart_document(self, node):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# def visit_meta(self, node):
|
|
||||||
# if node.hasattr('lang'):
|
|
||||||
# node['xml:lang'] = node['lang']
|
|
||||||
# meta = self.starttag(node, 'meta', **node.non_default_attributes())
|
|
||||||
# self.add_meta(meta)
|
|
||||||
# def depart_meta(self, node):
|
|
||||||
# pass
|
|
||||||
|
|
||||||
# Breaks Accounting memento if commented
|
# Breaks Accounting memento if commented
|
||||||
def visit_section(self, node):
|
def visit_section(self, node):
|
||||||
# close "parent" or preceding section, unless this is the opening of
|
# close "parent" or preceding section, unless this is the opening of
|
||||||
@ -132,13 +114,6 @@ class BootstrapTranslator(HTML5Translator):
|
|||||||
if not self.section_level:
|
if not self.section_level:
|
||||||
self.body.append(u'</section>')
|
self.body.append(u'</section>')
|
||||||
|
|
||||||
# # VFE FIXME do we need to keep this logic ?
|
|
||||||
# # Seems that the only change is the use of a nav instead of a div.
|
|
||||||
# def visit_topic(self, node):
|
|
||||||
# self.body.append(self.starttag(node, 'nav'))
|
|
||||||
# def depart_topic(self, node):
|
|
||||||
# self.body.append(u'</nav>')
|
|
||||||
|
|
||||||
# overwritten
|
# overwritten
|
||||||
# Class mapping:
|
# Class mapping:
|
||||||
# admonition [name] -> alert-[name]
|
# admonition [name] -> alert-[name]
|
||||||
@ -185,415 +160,3 @@ class BootstrapTranslator(HTML5Translator):
|
|||||||
classes.append('align-%s' % node['align'])
|
classes.append('align-%s' % node['align'])
|
||||||
tag = self.starttag(node, 'table', CLASS=' '.join(classes))
|
tag = self.starttag(node, 'table', CLASS=' '.join(classes))
|
||||||
self.body.append(tag)
|
self.body.append(tag)
|
||||||
|
|
||||||
# def is_compact_paragraph(self, node):
|
|
||||||
# parent = node.parent
|
|
||||||
# if isinstance(parent, (nodes.document, nodes.compound,
|
|
||||||
# addnodes.desc_content,
|
|
||||||
# addnodes.versionmodified)):
|
|
||||||
# # Never compact paragraphs in document or compound.
|
|
||||||
# return False
|
|
||||||
|
|
||||||
# for key, value in node.attlist():
|
|
||||||
# # we can ignore a few specific classes, all other non-default
|
|
||||||
# # attributes require that a <p> node remains
|
|
||||||
# if key != 'classes' or value not in ([], ['first'], ['last'], ['first', 'last']):
|
|
||||||
# return False
|
|
||||||
|
|
||||||
# first = isinstance(node.parent[0], nodes.label)
|
|
||||||
# for child in parent.children[first:]:
|
|
||||||
# # only first paragraph can be compact
|
|
||||||
# if isinstance(child, nodes.Invisible):
|
|
||||||
# continue
|
|
||||||
# if child is node:
|
|
||||||
# break
|
|
||||||
# return False
|
|
||||||
# parent_length = len([
|
|
||||||
# 1 for n in parent
|
|
||||||
# if not isinstance(n, (nodes.Invisible, nodes.label))
|
|
||||||
# ])
|
|
||||||
# return parent_length == 1
|
|
||||||
|
|
||||||
# def visit_paragraph(self, node):
|
|
||||||
# if self.is_compact_paragraph(node):
|
|
||||||
# self.context.append(u'')
|
|
||||||
# return
|
|
||||||
# self.body.append(self.starttag(node, 'p'))
|
|
||||||
# self.context.append(u'</p>')
|
|
||||||
# def depart_paragraph(self, node):
|
|
||||||
# self.body.append(self.context.pop())
|
|
||||||
|
|
||||||
# def visit_problematic(self, node):
|
|
||||||
# if node.hasattr('refid'):
|
|
||||||
# self.body.append('<a href="#%s">' % node['refid'])
|
|
||||||
# self.context.append('</a>')
|
|
||||||
# else:
|
|
||||||
# self.context.append('')
|
|
||||||
# self.body.append(self.starttag(node, 'span', CLASS='problematic'))
|
|
||||||
|
|
||||||
# def depart_problematic(self, node):
|
|
||||||
# self.body.append('</span>')
|
|
||||||
# self.body.append(self.context.pop())
|
|
||||||
|
|
||||||
# def visit_bullet_list(self, node):
|
|
||||||
# self.body.append(self.starttag(node, 'ul'))
|
|
||||||
# def depart_bullet_list(self, node):
|
|
||||||
# self.body.append(u'</ul>')
|
|
||||||
# def visit_enumerated_list(self, node):
|
|
||||||
# self.body.append(self.starttag(node, 'ol'))
|
|
||||||
# def depart_enumerated_list(self, node):
|
|
||||||
# self.body.append(u'</ol>')
|
|
||||||
# def visit_list_item(self, node):
|
|
||||||
# self.body.append(self.starttag(node, 'li'))
|
|
||||||
# def depart_list_item(self, node):
|
|
||||||
# self.body.append(u'</li>')
|
|
||||||
# def visit_definition_list(self, node):
|
|
||||||
# self.body.append(self.starttag(node, 'dl'))
|
|
||||||
# def depart_definition_list(self, node):
|
|
||||||
# self.body.append(u'</dl>')
|
|
||||||
# def visit_definition_list_item(self, node):
|
|
||||||
# pass
|
|
||||||
# def depart_definition_list_item(self, node):
|
|
||||||
# pass
|
|
||||||
# def visit_term(self, node):
|
|
||||||
# self.body.append(self.starttag(node, 'dt'))
|
|
||||||
# def depart_term(self, node):
|
|
||||||
# self.body.append(u'</dt>')
|
|
||||||
# def visit_termsep(self, node):
|
|
||||||
# self.body.append(self.starttag(node, 'br'))
|
|
||||||
# raise nodes.SkipNode
|
|
||||||
# def visit_definition(self, node):
|
|
||||||
# self.body.append(self.starttag(node, 'dd'))
|
|
||||||
# def depart_definition(self, node):
|
|
||||||
# self.body.append(u'</dd>')
|
|
||||||
|
|
||||||
# def visit_admonition(self, node, type=None):
|
|
||||||
# clss = {
|
|
||||||
# # ???: 'alert-success',
|
|
||||||
|
|
||||||
# 'note': 'alert-info',
|
|
||||||
# 'hint': 'alert-info',
|
|
||||||
# 'tip': 'alert-info',
|
|
||||||
# 'seealso': 'alert-go_to',
|
|
||||||
|
|
||||||
# 'warning': 'alert-warning',
|
|
||||||
# 'attention': 'alert-warning',
|
|
||||||
# 'caution': 'alert-warning',
|
|
||||||
# 'important': 'alert-warning',
|
|
||||||
|
|
||||||
# 'danger': 'alert-danger',
|
|
||||||
# 'error': 'alert-danger',
|
|
||||||
|
|
||||||
# 'exercise': 'alert-exercise',
|
|
||||||
# }
|
|
||||||
# self.body.append(self.starttag(node, 'div', role='alert', CLASS='alert {}'.format(
|
|
||||||
# clss.get(type, '')
|
|
||||||
# )))
|
|
||||||
# if 'alert-dismissible' in node.get('classes', []):
|
|
||||||
# self.body.append(
|
|
||||||
# u'<button type="button" class="close" data-dismiss="alert" aria-label="Close">'
|
|
||||||
# u'<span aria-hidden="true">×</span>'
|
|
||||||
# u'</button>')
|
|
||||||
# if type:
|
|
||||||
# node.insert(0, nodes.title(type, admonitionlabels[type]))
|
|
||||||
# def depart_admonition(self, node):
|
|
||||||
# self.body.append(u'</div>')
|
|
||||||
|
|
||||||
# def visit_versionmodified(self, node):
|
|
||||||
# self.body.append(self.starttag(node, 'div', CLASS=node['type']))
|
|
||||||
# def depart_versionmodified(self, node):
|
|
||||||
# self.body.append(u'</div>')
|
|
||||||
|
|
||||||
# # the rubric should be a smaller heading than the current section, up to
|
|
||||||
# # h6... maybe "h7" should be a ``p`` instead?
|
|
||||||
# def visit_rubric(self, node):
|
|
||||||
# self.body.append(self.starttag(node, 'h{}'.format(min(self.section_level + 1, 6))))
|
|
||||||
# def depart_rubric(self, node):
|
|
||||||
# self.body.append(u'</h{}>'.format(min(self.section_level + 1, 6)))
|
|
||||||
|
|
||||||
# # one more div in the base class: keep it?
|
|
||||||
# # def visit_block_quote(self, node):
|
|
||||||
# # self.body.append(self.starttag(node, 'blockquote'))
|
|
||||||
# # def depart_block_quote(self, node):
|
|
||||||
# # self.body.append(u'</blockquote>')
|
|
||||||
# def visit_attribution(self, node):
|
|
||||||
# self.body.append(self.starttag(node, 'footer'))
|
|
||||||
# def depart_attribution(self, node):
|
|
||||||
# self.body.append(u'</footer>')
|
|
||||||
|
|
||||||
# def visit_container(self, node):
|
|
||||||
# self.body.append(self.starttag(node, 'div'))
|
|
||||||
# def depart_container(self, node):
|
|
||||||
# self.body.append(u'</div>')
|
|
||||||
# def visit_compound(self, node):
|
|
||||||
# self.body.append(self.starttag(node, 'div'))
|
|
||||||
# def depart_compound(self, node):
|
|
||||||
# self.body.append(u'</div>')
|
|
||||||
|
|
||||||
# # overwritten, check if super can still be used
|
|
||||||
# def visit_image(self, node):
|
|
||||||
# uri = node['uri']
|
|
||||||
# if uri in self.builder.images:
|
|
||||||
# uri = posixpath.join(self.builder.imgpath,
|
|
||||||
# self.builder.images[uri])
|
|
||||||
# attrs = {'src': uri, 'class': 'img-fluid'}
|
|
||||||
# if 'alt' in node:
|
|
||||||
# attrs['alt'] = node['alt']
|
|
||||||
# if 'align' in node:
|
|
||||||
# if node['align'] == 'center':
|
|
||||||
# attrs['class'] += ' center-block'
|
|
||||||
# else:
|
|
||||||
# doc = None
|
|
||||||
# if node.source:
|
|
||||||
# doc = node.source
|
|
||||||
# if node.line:
|
|
||||||
# doc += ':%d' % node.line
|
|
||||||
# self.builder.app.warn(
|
|
||||||
# "Unsupported alignment value \"%s\"" % node['align'],
|
|
||||||
# location=doc
|
|
||||||
# )
|
|
||||||
# elif 'align' in node.parent and node.parent['align'] == 'center':
|
|
||||||
# # figure > image
|
|
||||||
# attrs['class'] += ' center-block'
|
|
||||||
|
|
||||||
# # todo: explicit width/height/scale?
|
|
||||||
# self.body.append(self.starttag(node, 'img', **attrs))
|
|
||||||
# def depart_image(self, node): pass
|
|
||||||
# def visit_figure(self, node):
|
|
||||||
# self.body.append(self.starttag(node, 'div'))
|
|
||||||
# def depart_figure(self, node):
|
|
||||||
# self.body.append(u'</div>')
|
|
||||||
# # def visit_caption(self, node):
|
|
||||||
# # # first paragraph of figure content
|
|
||||||
# # self.body.append(self.starttag(node, 'h4'))
|
|
||||||
# # def depart_caption(self, node):
|
|
||||||
# # self.body.append(u'</h4>')
|
|
||||||
# def visit_legend(self, node): pass
|
|
||||||
# def depart_legend(self, node): pass
|
|
||||||
|
|
||||||
# def visit_line(self, node):
|
|
||||||
# self.body.append(self.starttag(node, 'div', CLASS='line'))
|
|
||||||
# # ensure the line still takes the room it needs
|
|
||||||
# if not len(node): self.body.append(u'<br />')
|
|
||||||
# def depart_line(self, node):
|
|
||||||
# self.body.append(u'</div>')
|
|
||||||
|
|
||||||
# def visit_line_block(self, node):
|
|
||||||
# self.body.append(self.starttag(node, 'div', CLASS='line-block'))
|
|
||||||
# def depart_line_block(self, node):
|
|
||||||
# self.body.append(u'</div>')
|
|
||||||
|
|
||||||
# # def visit_table(self, node):
|
|
||||||
# # self.body.append(self.starttag(node, 'table', CLASS='table'))
|
|
||||||
# # def depart_table(self, node):
|
|
||||||
# # self.body.append(u'</table>')
|
|
||||||
# def visit_tgroup(self, node): pass
|
|
||||||
# def depart_tgroup(self, node): pass
|
|
||||||
# def visit_colspec(self, node): raise nodes.SkipNode
|
|
||||||
# def visit_thead(self, node):
|
|
||||||
# self.body.append(self.starttag(node, 'thead'))
|
|
||||||
# def depart_thead(self, node):
|
|
||||||
# self.body.append(u'</thead>')
|
|
||||||
# def visit_tbody(self, node):
|
|
||||||
# self.body.append(self.starttag(node, 'tbody'))
|
|
||||||
# def depart_tbody(self, node):
|
|
||||||
# self.body.append(u'</tbody>')
|
|
||||||
# def visit_row(self, node):
|
|
||||||
# self.body.append(self.starttag(node, 'tr'))
|
|
||||||
# def depart_row(self, node):
|
|
||||||
# self.body.append(u'</tr>')
|
|
||||||
# def visit_entry(self, node):
|
|
||||||
# if isinstance(node.parent.parent, nodes.thead):
|
|
||||||
# tagname = 'th'
|
|
||||||
# else:
|
|
||||||
# tagname = 'td'
|
|
||||||
# self.body.append(self.starttag(node, tagname))
|
|
||||||
# self.context.append(tagname)
|
|
||||||
# def depart_entry(self, node):
|
|
||||||
# self.body.append(u'</{}>'.format(self.context.pop()))
|
|
||||||
|
|
||||||
# # def visit_Text(self, node):
|
|
||||||
# # self.body.append(self.encode(node.astext()))
|
|
||||||
# # def depart_Text(self, node):
|
|
||||||
# # pass
|
|
||||||
# def visit_literal(self, node):
|
|
||||||
# self.body.append(self.starttag(node, 'code'))
|
|
||||||
# def depart_literal(self, node):
|
|
||||||
# self.body.append(u'</code>')
|
|
||||||
# visit_literal_emphasis = visit_literal
|
|
||||||
# depart_literal_emphasis = depart_literal
|
|
||||||
# def visit_emphasis(self, node):
|
|
||||||
# self.body.append(self.starttag(node, 'em'))
|
|
||||||
# def depart_emphasis(self, node):
|
|
||||||
# self.body.append(u'</em>')
|
|
||||||
# def visit_strong(self, node):
|
|
||||||
# self.body.append(self.starttag(node, 'strong'))
|
|
||||||
# def depart_strong(self, node):
|
|
||||||
# self.body.append(u'</strong>')
|
|
||||||
# visit_literal_strong = visit_strong
|
|
||||||
# depart_literal_strong = depart_strong
|
|
||||||
# def visit_inline(self, node):
|
|
||||||
# self.body.append(self.starttag(node, 'span'))
|
|
||||||
# def depart_inline(self, node):
|
|
||||||
# self.body.append(u'</span>')
|
|
||||||
|
|
||||||
# # def visit_download_reference(self, node):
|
|
||||||
# # # type: (nodes.Node) -> None
|
|
||||||
# # if node.hasattr('filename'):
|
|
||||||
# # self.body.append(
|
|
||||||
# # '<a class="reference download internal" href="%s" download="">' %
|
|
||||||
# # posixpath.join(self.builder.dlpath, node['filename']))
|
|
||||||
# # self.body.append(node.astext())
|
|
||||||
# # self.body.append('</a>')
|
|
||||||
# # raise nodes.SkipNode
|
|
||||||
# # else:
|
|
||||||
# # self.context.append('')
|
|
||||||
# # def depart_download_reference(self, node):
|
|
||||||
# # # type: (nodes.Node) -> None
|
|
||||||
# # self.body.append(self.context.pop())
|
|
||||||
# def visit_target(self, node): pass
|
|
||||||
# def depart_target(self, node): pass
|
|
||||||
# def visit_footnote(self, node):
|
|
||||||
# self.body.append(self.starttag(node, 'div', CLASS='footnote'))
|
|
||||||
# self.footnote_backrefs(node)
|
|
||||||
# def depart_footnote(self, node):
|
|
||||||
# self.body.append(u'</div>')
|
|
||||||
# def visit_footnote_reference(self, node):
|
|
||||||
# self.body.append(self.starttag(
|
|
||||||
# node, 'a', href='#' + node['refid'], CLASS="footnote-ref"))
|
|
||||||
# def depart_footnote_reference(self, node):
|
|
||||||
# self.body.append(u'</a>')
|
|
||||||
# def visit_label(self, node):
|
|
||||||
# self.body.append(self.starttag(node, 'span', CLASS='footnote-label'))
|
|
||||||
# self.body.append(u'%s[' % self.context.pop())
|
|
||||||
# def depart_label(self, node):
|
|
||||||
# # Context added in footnote_backrefs.
|
|
||||||
# self.body.append(u']%s</span> %s' % (self.context.pop(), self.context.pop()))
|
|
||||||
# def footnote_backrefs(self, node):
|
|
||||||
# # should store following data on context stack (in that order since
|
|
||||||
# # they'll be popped so LIFO)
|
|
||||||
# #
|
|
||||||
# # * outside (after) label
|
|
||||||
# # * after label text
|
|
||||||
# # * before label text
|
|
||||||
# backrefs = node['backrefs']
|
|
||||||
# if not backrefs:
|
|
||||||
# self.context.extend(['', '', ''])
|
|
||||||
# elif len(backrefs) == 1:
|
|
||||||
# self.context.extend([
|
|
||||||
# '',
|
|
||||||
# '</a>',
|
|
||||||
# '<a class="footnote-backref" href="#%s">' % backrefs[0]
|
|
||||||
# ])
|
|
||||||
# else:
|
|
||||||
# backlinks = (
|
|
||||||
# '<a class="footnote-backref" href="#%s">%s</a>' % (backref, i)
|
|
||||||
# for i, backref in enumerate(backrefs, start=1)
|
|
||||||
# )
|
|
||||||
# self.context.extend([
|
|
||||||
# '<em class="footnote-backrefs">(%s)</em> ' % ', '.join(backlinks),
|
|
||||||
# '',
|
|
||||||
# ''
|
|
||||||
# ])
|
|
||||||
|
|
||||||
# def visit_desc(self, node):
|
|
||||||
# self.body.append(self.starttag(node, 'section', CLASS='code-' + node['objtype']))
|
|
||||||
# def depart_desc(self, node):
|
|
||||||
# self.body.append(u'</section>')
|
|
||||||
# def visit_desc_signature(self, node):
|
|
||||||
# self.body.append(self.starttag(node, 'h6'))
|
|
||||||
# self.body.append(u'<code>')
|
|
||||||
# def depart_desc_signature(self, node):
|
|
||||||
# self.body.append(u'</code>')
|
|
||||||
# self.body.append(u'</h6>')
|
|
||||||
# def visit_desc_addname(self, node): pass
|
|
||||||
# def depart_desc_addname(self, node): pass
|
|
||||||
# def visit_desc_type(self, node): pass
|
|
||||||
# def depart_desc_type(self, node): pass
|
|
||||||
# def visit_desc_returns(self, node):
|
|
||||||
# self.body.append(u' → ')
|
|
||||||
# def depart_desc_returns(self, node):
|
|
||||||
# pass
|
|
||||||
# def visit_desc_name(self, node): pass
|
|
||||||
# def depart_desc_name(self, node): pass
|
|
||||||
# def visit_desc_parameterlist(self, node):
|
|
||||||
# self.body.append(u'(')
|
|
||||||
# self.first_param = True
|
|
||||||
# self.optional_param_level = 0
|
|
||||||
# # How many required parameters are left.
|
|
||||||
# self.required_params_left = sum(isinstance(c, addnodes.desc_parameter) for c in node.children)
|
|
||||||
# self.param_separator = node.child_text_separator
|
|
||||||
# def depart_desc_parameterlist(self, node):
|
|
||||||
# self.body.append(u')')
|
|
||||||
# # If required parameters are still to come, then put the comma after
|
|
||||||
# # the parameter. Otherwise, put the comma before. This ensures that
|
|
||||||
# # signatures like the following render correctly (see issue #1001):
|
|
||||||
# #
|
|
||||||
# # foo([a, ]b, c[, d])
|
|
||||||
# #
|
|
||||||
# def visit_desc_parameter(self, node):
|
|
||||||
# if self.first_param:
|
|
||||||
# self.first_param = 0
|
|
||||||
# elif not self.required_params_left:
|
|
||||||
# self.body.append(self.param_separator)
|
|
||||||
# if self.optional_param_level == 0:
|
|
||||||
# self.required_params_left -= 1
|
|
||||||
# if 'noemph' not in node: self.body.append(u'<em>')
|
|
||||||
# def depart_desc_parameter(self, node):
|
|
||||||
# if 'noemph' not in node: self.body.append(u'</em>')
|
|
||||||
# if self.required_params_left:
|
|
||||||
# self.body.append(self.param_separator)
|
|
||||||
# def visit_desc_optional(self, node):
|
|
||||||
# self.optional_param_level += 1
|
|
||||||
# self.body.append(u'[')
|
|
||||||
# def depart_desc_optional(self, node):
|
|
||||||
# self.optional_param_level -= 1
|
|
||||||
# self.body.append(u']')
|
|
||||||
# def visit_desc_annotation(self, node):
|
|
||||||
# self.body.append(self.starttag(node, 'em'))
|
|
||||||
# def depart_desc_annotation(self, node):
|
|
||||||
# self.body.append(u'</em>')
|
|
||||||
# def visit_desc_content(self, node): pass
|
|
||||||
# def depart_desc_content(self, node): pass
|
|
||||||
# def visit_field_list(self, node):
|
|
||||||
# self.body.append(self.starttag(node, 'div', CLASS='code-fields'))
|
|
||||||
# def depart_field_list(self, node):
|
|
||||||
# self.body.append(u'</div>')
|
|
||||||
# def visit_field(self, node):
|
|
||||||
# self.body.append(self.starttag(node, 'div', CLASS='code-field'))
|
|
||||||
# def depart_field(self, node):
|
|
||||||
# self.body.append(u'</div>')
|
|
||||||
# def visit_field_name(self, node):
|
|
||||||
# self.body.append(self.starttag(node, 'div', CLASS='code-field-name'))
|
|
||||||
# def depart_field_name(self, node):
|
|
||||||
# self.body.append(u'</div>')
|
|
||||||
# def visit_field_body(self, node):
|
|
||||||
# self.body.append(self.starttag(node, 'div', CLASS='code-field-body'))
|
|
||||||
# def depart_field_body(self, node):
|
|
||||||
# self.body.append(u'</div>')
|
|
||||||
|
|
||||||
# def visit_raw(self, node):
|
|
||||||
# if 'html' in node.get('format', '').split():
|
|
||||||
# t = 'span' if isinstance(node.parent, nodes.TextElement) else 'div'
|
|
||||||
# if node['classes']:
|
|
||||||
# self.body.append(self.starttag(node, t))
|
|
||||||
# self.body.append(node.astext())
|
|
||||||
# if node['classes']:
|
|
||||||
# self.body.append('</%s>' % t)
|
|
||||||
# # Keep non-HTML raw text out of output:
|
|
||||||
# raise nodes.SkipNode
|
|
||||||
|
|
||||||
# # internal node
|
|
||||||
# def visit_substitution_definition(self, node): raise nodes.SkipNode
|
|
||||||
|
|
||||||
# # without set_translator, add_node doesn't work correctly, so the
|
|
||||||
# # serialization of html_domain nodes needs to be embedded here
|
|
||||||
# def visit_div(self, node):
|
|
||||||
# self.body.append(self.starttag(node, 'div'))
|
|
||||||
# def depart_div(self, node):
|
|
||||||
# self.body.append(u'</div>\n')
|
|
||||||
# def visit_address(self, node):
|
|
||||||
# self.body.append(self.starttag(node, 'address'))
|
|
||||||
# def depart_address(self, node):
|
|
||||||
# self.body.append(u'</address>')
|
|
||||||
# # TODO: inline elements
|
|
||||||
|
@ -62,3 +62,8 @@ def generate_redirects(app):
|
|||||||
def setup(app):
|
def setup(app):
|
||||||
app.add_config_value('redirects_file', 'redirects', 'env')
|
app.add_config_value('redirects_file', 'redirects', 'env')
|
||||||
app.connect('builder-inited', generate_redirects)
|
app.connect('builder-inited', generate_redirects)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'parallel_read_safe': True,
|
||||||
|
'parallel_write_safe': True
|
||||||
|
}
|
||||||
|
@ -12,6 +12,11 @@ def setup(app):
|
|||||||
|
|
||||||
app.connect('env-updated', add_statics)
|
app.connect('env-updated', add_statics)
|
||||||
|
|
||||||
|
return {
|
||||||
|
'parallel_read_safe': True,
|
||||||
|
'parallel_write_safe': True
|
||||||
|
}
|
||||||
|
|
||||||
def add_statics(app, env):
|
def add_statics(app, env):
|
||||||
app.add_js_file('js/switcher.js')
|
app.add_js_file('js/switcher.js')
|
||||||
env.config.html_static_path.append(statics())
|
env.config.html_static_path.append(statics())
|
||||||
|
Loading…
Reference in New Issue
Block a user