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
b31737457a
42
conf.py
42
conf.py
@ -11,11 +11,10 @@ _logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
#=== General configuration ===#
|
#=== General configuration ===#
|
||||||
|
|
||||||
# The version info for the project being documented, acts as replacement for |version|, also used in
|
# `version` if the version info for the project being documented, acts as replacement for |version|,
|
||||||
# various other places throughout the built documents.
|
# also used in various other places throughout the built documents.
|
||||||
version = '12.0'
|
# `release` is the full version, including alpha/beta/rc tags. Acts as replacement for |release|.
|
||||||
# The full version, including alpha/beta/rc tags. Acts as replacement for |release|.
|
version = release = '12.0'
|
||||||
release = '12.0'
|
|
||||||
|
|
||||||
# The minimal Sphinx version required to build the documentation.
|
# The minimal Sphinx version required to build the documentation.
|
||||||
needs_sphinx = '3.0.0'
|
needs_sphinx = '3.0.0'
|
||||||
@ -47,7 +46,7 @@ exclude_patterns = [
|
|||||||
# See https://docutils.sourceforge.io/docs/ref/rst/roles.html#standard-roles for other roles.
|
# See https://docutils.sourceforge.io/docs/ref/rst/roles.html#standard-roles for other roles.
|
||||||
default_role = 'literal'
|
default_role = 'literal'
|
||||||
|
|
||||||
# If true, '()' will be appended to :func: etc. cross-reference text.
|
# If true, '()' will be appended to :func: etc. cross-reference text
|
||||||
add_function_parentheses = True
|
add_function_parentheses = True
|
||||||
|
|
||||||
#=== Extensions configuration ===#
|
#=== Extensions configuration ===#
|
||||||
@ -58,17 +57,28 @@ sys.path.insert(0, str(extension_dir.absolute()))
|
|||||||
|
|
||||||
# Search for the directory of odoo sources to know whether autodoc should be used on the dev doc
|
# Search for the directory of odoo sources to know whether autodoc should be used on the dev doc
|
||||||
odoo_dir = Path('odoo')
|
odoo_dir = Path('odoo')
|
||||||
if odoo_dir.exists() and odoo_dir.is_dir():
|
odoo_dir_in_path = False
|
||||||
sys.path.insert(0, str(odoo_dir.absolute()))
|
if not odoo_dir.is_dir():
|
||||||
odoo_dir_in_path = True
|
|
||||||
else:
|
|
||||||
_logger.warning(
|
_logger.warning(
|
||||||
f"Could not find Odoo sources directory at {odoo_dir.absolute()}.\n"
|
f"Could not find Odoo sources directory at {odoo_dir.absolute()}.\n"
|
||||||
"The 'Developer' documentation will be built but autodoc directives will be skipped.\n"
|
f"The 'Developer' documentation will be built but autodoc directives will be skipped.\n"
|
||||||
"In order to fully build the 'Developer' documentation, clone the repository with "
|
f"In order to fully build the 'Developer' documentation, clone the repository with "
|
||||||
"`git clone https://github.com/odoo/odoo`."
|
f"`git clone https://github.com/odoo/odoo` or create a symbolink link."
|
||||||
)
|
)
|
||||||
odoo_dir_in_path = False
|
else:
|
||||||
|
sys.path.insert(0, str(odoo_dir.absolute()))
|
||||||
|
from odoo import release as odoo_release # Don't collide with Sphinx's 'release' config option
|
||||||
|
if release != odoo_release.version:
|
||||||
|
_logger.warning(
|
||||||
|
f"Found Odoo sources directory but with version {odoo_release.version} incompatible "
|
||||||
|
f"with documentation version {version}.\n"
|
||||||
|
f"The 'Developer' documentation will be built but autodoc directives will be skipped.\n"
|
||||||
|
f"In order to fully build the 'Developer' documentation, checkout the matching branch"
|
||||||
|
f" with `cd odoo && git checkout {version}`."
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
_logger.info(f"Found Odoo sources directory matching documentation version {release}.")
|
||||||
|
odoo_dir_in_path = True
|
||||||
|
|
||||||
# The Sphinx extensions to use, as module names.
|
# The Sphinx extensions to use, as module names.
|
||||||
# They can be extensions coming with Sphinx (named 'sphinx.ext.*') or custom ones.
|
# They can be extensions coming with Sphinx (named 'sphinx.ext.*') or custom ones.
|
||||||
@ -256,10 +266,6 @@ def setup(app):
|
|||||||
app.connect('doctree-resolved', tag_toctrees) # TODO ANVFE not used + typo
|
app.connect('doctree-resolved', tag_toctrees) # TODO ANVFE not used + typo
|
||||||
|
|
||||||
|
|
||||||
def export_collapse_menu_option(app, pagename, templatename, context, doctree):
|
|
||||||
context['collapse_menu'] = app.config.collapse_menu
|
|
||||||
|
|
||||||
|
|
||||||
def versionize(app, pagename, templatename, context, doctree):
|
def versionize(app, pagename, templatename, context, doctree):
|
||||||
""" Adds a version switcher below the menu, requires ``canonical_root``
|
""" Adds a version switcher below the menu, requires ``canonical_root``
|
||||||
and ``versions`` (an ordered, space-separated lists of all possible
|
and ``versions`` (an ordered, space-separated lists of all possible
|
||||||
|
@ -10,6 +10,7 @@ rendered more or less directly to HTML.
|
|||||||
|
|
||||||
NOTE: this extension is only used by special accounting pages (memento, valuation, ...)
|
NOTE: this extension is only used by special accounting pages (memento, valuation, ...)
|
||||||
for directives likes .. h:div::
|
for directives likes .. h:div::
|
||||||
|
TO REMOVE AS SOON AS WE DROP MEMENTOES
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from docutils import nodes, utils
|
from docutils import nodes, utils
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from docutils import nodes, utils
|
from docutils import nodes
|
||||||
from docutils.parsers.rst import Directive
|
from docutils.parsers.rst import Directive
|
||||||
|
|
||||||
from pygments.lexers import get_lexer_by_name
|
from pygments.lexers import get_lexer_by_name
|
||||||
@ -23,8 +23,9 @@ class SwitcherDirective(Directive):
|
|||||||
if isinstance(child, nodes.literal_block):
|
if isinstance(child, nodes.literal_block):
|
||||||
titles.append(get_lexer_by_name(child['language']).name)
|
titles.append(get_lexer_by_name(child['language']).name)
|
||||||
else:
|
else:
|
||||||
assert child['names'], ("A switcher case must be either a "
|
assert child['names'], (
|
||||||
"code block or a compound with a name")
|
"A switcher case must be either a code block or a compound with a name"
|
||||||
|
)
|
||||||
titles.append(' '.join(child['names']))
|
titles.append(' '.join(child['names']))
|
||||||
tabs = nodes.bullet_list('', *[
|
tabs = nodes.bullet_list('', *[
|
||||||
nodes.list_item('', nodes.Text(title))
|
nodes.list_item('', nodes.Text(title))
|
||||||
@ -41,8 +42,6 @@ class CaseDirective(Directive):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.assert_has_content()
|
self.assert_has_content()
|
||||||
|
node = nodes.compound('\n'.join(self.content), names=[self.arguments[0]])
|
||||||
node = nodes.compound('\n'.join(self.content),
|
|
||||||
names=[self.arguments[0]])
|
|
||||||
self.state.nested_parse(self.content, self.content_offset, node)
|
self.state.nested_parse(self.content, self.content_offset, node)
|
||||||
return [node]
|
return [node]
|
||||||
|
Loading…
Reference in New Issue
Block a user