1 # -*- coding: utf-8 -*-
5 # If extensions (or modules to document with autodoc) are in another directory,
6 # add these directories to sys.path here. If the directory is relative to the
7 # documentation root, use os.path.abspath to make it absolute, like shown here.
8 DIR = os.path.dirname(__file__)
11 os.path.join(DIR, '_themes')))
13 sys.path.append(os.path.abspath(os.path.join(DIR, '..')))
15 # -- General configuration -----------------------------------------------------
17 # If your documentation needs a minimal Sphinx version, state it here.
20 # Add any Sphinx extension module names here, as strings. They can be extensions
21 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
23 'sphinx.ext.ifconfig',
26 'sphinx.ext.intersphinx',
30 if sphinx.__version__.split('.') >= ['1', '2']:
31 # linkcode is only available from Sphinx 1.2
32 extensions.insert(0, 'sphinx.ext.linkcode')
35 # Add any paths that contain templates here, relative to this directory.
36 templates_path = ['_templates']
38 # The suffix of source filenames.
39 source_suffix = '.rst'
41 # The encoding of source files.
42 #source_encoding = 'utf-8-sig'
44 # The master toctree document.
47 # General information about the project.
49 copyright = u'Odoo S.A.'
51 # The version info for the project you're documenting, acts as replacement for
52 # |version| and |release|, also used in various other places throughout the
55 # The short X.Y version.
57 # The full version, including alpha/beta/rc tags.
60 # There are two options for replacing |today|: either, you set today to some
61 # non-false value, then it is used:
63 # Else, today_fmt is used as the format for a strftime call.
64 today_fmt = '%B %d, %Y'
66 # List of patterns, relative to source directory, that match files and
67 # directories to ignore when looking for source files.
68 exclude_patterns = ['_build']
70 # The reST default role (used for this markup: `text`) to use for all documents.
73 # If true, '()' will be appended to :func: etc. cross-reference text.
74 add_function_parentheses = True
76 # If true, the current module name will be prepended to all description
77 # unit titles (such as .. function::).
78 #add_module_names = True
80 # If true, sectionauthor and moduleauthor directives will be shown in the
81 # output. They are ignored by default.
84 # The name of the Pygments (syntax highlighting) style to use.
85 pygments_style = 'odoo'
87 # A list of ignored prefixes for module index sorting.
88 #modindex_common_prefix = []
91 # -- Options for HTML output ---------------------------------------------------
92 # The theme to use for HTML and HTML Help pages. See the documentation for
93 # a list of builtin themes.
94 html_theme = 'odoodoc'
96 # Theme options are theme-specific and customize the look and feel of a theme
97 # further. For a list of options available for each theme, see the
99 #html_theme_options = {}
101 # Add any paths that contain custom themes here, relative to this directory.
102 html_theme_path = ['_themes']
104 # The name for this set of Sphinx documents. If None, it defaults to
105 # "<project> v<release> documentation".
108 # A shorter title for the navigation bar. Default is the same as html_title.
109 #html_short_title = None
111 # The name of an image file (relative to this directory) to place at the top
115 # The name of an image file (within the static path) to use as favicon of the
116 # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
120 # Add any paths that contain custom static files (such as style sheets) here,
121 # relative to this directory. They are copied after the builtin static files,
122 # so a file named "default.css" will overwrite the builtin "default.css".
123 html_static_path = ['_static']
125 html_style = "odoo.css"
127 html_add_permalinks = False
129 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
130 # using the given strftime format.
131 #html_last_updated_fmt = '%b %d, %Y'
133 # If true, SmartyPants will be used to convert quotes and dashes to
134 # typographically correct entities.
135 #html_use_smartypants = True
137 # Custom sidebar templates, maps document names to template names.
138 # FIXME: no sidebar on index?
142 # Additional templates that should be rendered to pages, maps page names to
144 #html_additional_pages = {}
146 # If false, no module index is generated.
147 #html_domain_indices = True
149 # If false, no index is generated.
150 #html_use_index = True
152 # If true, the index is split into individual pages for each letter.
153 #html_split_index = False
155 # If true, links to the reST sources are added to the pages.
156 #html_show_sourcelink = True
158 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
159 #html_show_sphinx = True
161 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
162 #html_show_copyright = True
164 # If true, an OpenSearch description file will be output, and all pages will
165 # contain a <link> tag referring to it. The value of this option must be the
166 # base URL from which the finished HTML is served.
167 #html_use_opensearch = ''
170 'papersize': r'a4paper',
171 'preamble': u'''\\setcounter{tocdepth}{2}
175 # default must be set otherwise ifconfig blows up
176 todo_include_todos = False
178 intersphinx_mapping = {
179 'python': ('https://docs.python.org/2/', None),
180 'werkzeug': ('http://werkzeug.pocoo.org/docs/', None),
181 'sqlalchemy': ('http://docs.sqlalchemy.org/en/rel_0_9/', None),
182 'django': ('https://django.readthedocs.org/en/latest/', None),
186 github_project = 'odoo'
189 app.connect('html-page-context', canonicalize)
190 app.add_config_value('canonical_root', None, 'env')
191 app.add_config_value('canonical_branch', 'master', 'env')
193 app.connect('html-page-context', versionize)
194 app.add_config_value('versions', '', 'env')
196 app.connect('html-page-context', analytics)
197 app.add_config_value('google_analytics_key', False, 'env')
199 def canonicalize(app, pagename, templatename, context, doctree):
200 """ Adds a 'canonical' URL for the current document in the rendering
201 context. Requires the ``canonical_root`` setting being set. The canonical
202 branch is ``master`` but can be overridden using ``canonical_branch``.
204 if not app.config.canonical_root:
207 context['canonical'] = _build_url(
208 app.config.canonical_root, app.config.canonical_branch, pagename)
210 def versionize(app, pagename, templatename, context, doctree):
211 """ Adds a version switcher below the menu, requires ``canonical_root``
212 and ``versions`` (an ordered, space-separated lists of all possible
215 if not (app.config.canonical_root and app.config.versions):
218 context['versions'] = [
219 (vs, _build_url(app.config.canonical_root, vs, pagename))
220 for vs in app.config.versions.split(',')
221 if vs != app.config.version
224 def analytics(app, pagename, templatename, context, doctree):
225 if not app.config.google_analytics_key:
228 context['google_analytics_key'] = app.config.google_analytics_key
230 def _build_url(root, branch, pagename):
231 return "{canonical_url}{canonical_branch}/{canonical_page}".format(
233 canonical_branch=branch,
234 canonical_page=(pagename + '.html').replace('index.html', '')
235 .replace('index/', ''),