[MERGE] config.py between docs

This commit is contained in:
Victor Feyens 2020-09-24 17:45:36 +02:00
parent 65b85f289d
commit 3509521c76

177
conf.py
View File

@ -9,10 +9,13 @@ sys.path.insert(0,
os.path.abspath(
os.path.join(DIR, '_extensions')))
# put current odoo's source on PYTHONPATH for autodoc
sys.path.insert(0, os.path.abspath(os.path.join(DIR, '../odoo')))
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
needs_sphinx = '1.2'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
@ -21,11 +24,17 @@ extensions = [
'sphinx.ext.ifconfig',
'sphinx.ext.todo',
'odoo_ext',
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.linkcode',
'demo_link',
'embedded_video',
'github_link',
# 'autojsdoc.ext',
'html_domain',
'redirects',
'exercise_admonition',
'patchqueue',
]
# Add any paths that contain templates here, relative to this directory.
@ -41,20 +50,17 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
project = u'Odoo'
copyright = u'2015-TODAY, Odoo S.A.'
project = u'odoo'
copyright = u'Odoo S.A.'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '14.0'
# The full version, including alpha/beta/rc tags.
release = '13.0'
version = '13.0'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
release = '14.0'
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
@ -75,12 +81,12 @@ exclude_patterns = [
# The specifications of redirect rules used by the redirects extension.
redirects_file = 'redirects.txt'
# The reST default role (used for this markup: `text`) to use for all
# documents.
#default_role = None
# markdown compatibility: make `foo` behave like ``foo``, the rst default is
# title-reference which is never what people are looking for
default_role = 'literal'
# If true, '()' will be appended to :func: etc. cross-reference text.
#add_function_parentheses = True
add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
@ -104,7 +110,9 @@ pygments_style = 'odoo'
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'odoo'
html_theme = 'odoo_ext'
odoo_cover_default = 'banners/installing_odoo.jpg'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
@ -135,7 +143,8 @@ html_theme_path = ['_extensions']
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
# VFE TODO merge _static folders
html_static_path = ['_static', 'developer/_static']
html_add_permalinks = ''
# Add any extra paths that contain custom files (such as robots.txt or
@ -191,20 +200,19 @@ htmlhelp_basename = 'UnderstandingAccountingForEntrepreneursdoc'
# -- Options for LaTeX output ---------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
'papersize': 'a4paper',
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
'papersize': 'a4paper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
'preamble': r'\usepackage{odoo}',
'tableofcontents': r'', # no TOC
# Additional stuff for the LaTeX preamble.
'preamble': r'\usepackage{odoo}',
'tableofcontents': r'', # no TOC
# output manually in latex docs
'releasename': '',
# output manually in latex docs
'releasename': '14.0',
}
latex_additional_files = ['_static/latex/odoo.sty']
@ -213,84 +221,39 @@ latex_additional_files = ['_static/latex/odoo.sty']
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
('legal/terms/enterprise_tex', 'odoo_enterprise_agreement.tex', 'Odoo Enterprise Subscription Agreement', '', 'howto'),
('legal/terms/partnership_tex', 'odoo_partnership_agreement.tex', 'Odoo Partnership Agreement', '', 'howto'),
('legal/terms/terms_of_sale', 'terms_of_sale.tex', 'Odoo Terms of Sale', '', 'howto'),
# VFE TODO move those files into static folder ?
('user/practical/legal/terms/enterprise_tex', 'odoo_enterprise_agreement.tex', 'Odoo Enterprise Subscription Agreement', '', 'howto'),
('user/practical/legal/terms/partnership_tex', 'odoo_partnership_agreement.tex', 'Odoo Partnership Agreement', '', 'howto'),
('user/practical/legal/terms/terms_of_sale', 'terms_of_sale.tex', 'Odoo Terms of Sale', '', 'howto'),
('legal/terms/i18n/enterprise_tex_fr', 'odoo_enterprise_agreement_fr.tex', 'Odoo Enterprise Subscription Agreement (FR)', '', 'howto'),
('legal/terms/i18n/partnership_tex_fr', 'odoo_partnership_agreement_fr.tex', 'Odoo Partnership Agreement (FR)', '', 'howto'),
('legal/terms/i18n/terms_of_sale_fr', 'terms_of_sale_fr.tex', u'Conditions Générales de Vente Odoo', '', 'howto'),
('user/practical/legal/terms/i18n/enterprise_tex_fr', 'odoo_enterprise_agreement_fr.tex', 'Odoo Enterprise Subscription Agreement (FR)', '', 'howto'),
('user/practical/legal/terms/i18n/partnership_tex_fr', 'odoo_partnership_agreement_fr.tex', 'Odoo Partnership Agreement (FR)', '', 'howto'),
('user/practical/legal/terms/i18n/terms_of_sale_fr', 'terms_of_sale_fr.tex', u'Conditions Générales de Vente Odoo', '', 'howto'),
('legal/terms/i18n/enterprise_tex_nl', 'odoo_enterprise_agreement_nl.tex', 'Odoo Enterprise Subscription Agreement (NL)', '', 'howto'),
#('legal/terms/i18n/partnership_tex_nl', 'odoo_partnership_agreement_nl.tex', 'Odoo Partnership Agreement (NL)', '', 'howto'),
('user/practical/legal/terms/i18n/enterprise_tex_nl', 'odoo_enterprise_agreement_nl.tex', 'Odoo Enterprise Subscription Agreement (NL)', '', 'howto'),
#('user/practical/legal/terms/i18n/partnership_tex_nl', 'odoo_partnership_agreement_nl.tex', 'Odoo Partnership Agreement (NL)', '', 'howto'),
('legal/terms/i18n/enterprise_tex_de', 'odoo_enterprise_agreement_de.tex', 'Odoo Enterprise Subscription Agreement (DE)', '', 'howto'),
#('legal/terms/i18n/partnership_tex_de', 'odoo_partnership_agreement_de.tex', 'Odoo Partnership Agreement (DE)', '', 'howto'),
('user/practical/legal/terms/i18n/enterprise_tex_de', 'odoo_enterprise_agreement_de.tex', 'Odoo Enterprise Subscription Agreement (DE)', '', 'howto'),
#('user/practical/legal/terms/i18n/partnership_tex_de', 'odoo_partnership_agreement_de.tex', 'Odoo Partnership Agreement (DE)', '', 'howto'),
('legal/terms/i18n/enterprise_tex_es', 'odoo_enterprise_agreement_es.tex', 'Odoo Enterprise Subscription Agreement (ES)', '', 'howto'),
('legal/terms/i18n/partnership_tex_es', 'odoo_partnership_agreement_es.tex', 'Odoo Partnership Agreement (ES)', '', 'howto'),
('user/practical/legal/terms/i18n/enterprise_tex_es', 'odoo_enterprise_agreement_es.tex', 'Odoo Enterprise Subscription Agreement (ES)', '', 'howto'),
('user/practical/legal/terms/i18n/partnership_tex_es', 'odoo_partnership_agreement_es.tex', 'Odoo Partnership Agreement (ES)', '', 'howto'),
#('index', 'UnderstandingAccountingForEntrepreneurs.tex', u'Understanding Accounting For Entrepreneurs Documentation', u'fp, xmo', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
# the title page.
latex_logo = '_static/icons/odoo_logo.png'
# VFE TODO _static folder shared by two docs for some generic files ?
latex_logo = 'user/_static/banners/odoo_logo.png'
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
#latex_use_parts = False
# default must be set otherwise ifconfig blows up
todo_include_todos = False
# If true, show page references after internal links.
#latex_show_pagerefs = False
# If true, show URL addresses after external links.
latex_show_urls = "True"
# Documents to append as an appendix to all manuals.
#latex_appendices = []
# If false, no module index is generated.
#latex_domain_indices = True
# -- Options for manual page output ---------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'understandingaccountingforentrepreneurs', u'Understanding Accounting For Entrepreneurs Documentation',
[u'fp, xmo'], 1)
]
# If true, show URL addresses after external links.
#man_show_urls = False
# -- Options for Texinfo output -------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'UnderstandingAccountingForEntrepreneurs', u'Understanding Accounting For Entrepreneurs Documentation',
u'fp, xmo', 'UnderstandingAccountingForEntrepreneurs', 'One line description of project.',
'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.
#texinfo_appendices = []
# If false, no module index is generated.
#texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
#texinfo_show_urls = 'footnote'
# If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False
odoo_cover_external = {}
intersphinx_mapping = {
'python': ('https://docs.python.org/3/', None),
'werkzeug': ('http://werkzeug.pocoo.org/docs/', None),
}
github_user = 'odoo'
github_project = 'documentation-user'
@ -309,6 +272,10 @@ LANGUAGES = {
'uk': 'Ukrainian',
'zh_CN': 'Chinese',
}
# monkeypatch PHP lexer to not require <?php
from sphinx.highlighting import lexers
from pygments.lexers.web import PhpLexer
lexers['php'] = PhpLexer(startinline=True)
def setup(app):
app.add_stylesheet('accounting.css')
@ -350,11 +317,8 @@ def versionize(app, pagename, templatename, context, doctree):
if not (app.config.canonical_root and app.config.versions):
return
# remove last fragment containing the version
root = '/'.join(app.config.canonical_root.rstrip('/').split('/')[:-1])
context['versions'] = [
(vs, _build_url(root, vs, pagename))
(vs, _build_url(app.config.canonical_root, vs, pagename))
for vs in app.config.versions.split(',')
if vs != app.config.version
]
@ -413,21 +377,24 @@ def canonicalize(app, pagename, templatename, context, doctree):
if not app.config.canonical_root:
return
# remove last fragment containing the version
root = '/'.join(app.config.canonical_root.rstrip('/').split('/')[:-1])
root += '/' + app.config.canonical_branch
def canonicalize(app, pagename, templatename, context, doctree):
""" Adds a 'canonical' URL for the current document in the rendering
context. Requires the ``canonical_root`` setting being set. The canonical
branch is ``master`` but can be overridden using ``canonical_branch``.
"""
if not app.config.canonical_root:
return
current_lang = app.config.language or 'en'
context['canonical'] = _build_url(
root, (current_lang != 'en' and current_lang or ''), pagename)
app.config.canonical_root, app.config.canonical_branch, pagename, lang)
def _build_url(root, branch, pagename):
root = root.rstrip('/')
if branch:
root += '/'
return "{canonical_url}{canonical_branch}/{canonical_page}".format(
def _build_url(root, branch, pagename, lang='en'):
return "{canonical_url}{canonical_branch}{lang}/{canonical_page}".format(
canonical_url=root,
canonical_branch=branch,
lang=current_lang != 'en' and current_lang or '',
canonical_page=(pagename + '.html').replace('index.html', '')
.replace('index/', ''),
)