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.
25 'sphinx.ext.intersphinx',
29 if sphinx.__version__.split('.') >= ['1', '2']:
30 # linkcode is only available from Sphinx 1.2
31 extensions.insert(0, 'sphinx.ext.linkcode')
34 # Add any paths that contain templates here, relative to this directory.
35 templates_path = ['_templates']
37 # The suffix of source filenames.
38 source_suffix = '.rst'
40 # The encoding of source files.
41 #source_encoding = 'utf-8-sig'
43 # The master toctree document.
46 # General information about the project.
47 project = u'odoo developer documentation'
48 copyright = u'2014, OpenERP s.a.'
50 # The version info for the project you're documenting, acts as replacement for
51 # |version| and |release|, also used in various other places throughout the
54 # The short X.Y version.
56 # The full version, including alpha/beta/rc tags.
59 # There are two options for replacing |today|: either, you set today to some
60 # non-false value, then it is used:
62 # Else, today_fmt is used as the format for a strftime call.
63 today_fmt = '%B %d, %Y'
65 # List of patterns, relative to source directory, that match files and
66 # directories to ignore when looking for source files.
67 exclude_patterns = ['_build']
69 # The reST default role (used for this markup: `text`) to use for all documents.
72 # If true, '()' will be appended to :func: etc. cross-reference text.
73 add_function_parentheses = True
75 # If true, the current module name will be prepended to all description
76 # unit titles (such as .. function::).
77 #add_module_names = True
79 # If true, sectionauthor and moduleauthor directives will be shown in the
80 # output. They are ignored by default.
83 # The name of the Pygments (syntax highlighting) style to use.
84 pygments_style = 'odoo'
86 # A list of ignored prefixes for module index sorting.
87 #modindex_common_prefix = []
90 # -- Options for HTML output ---------------------------------------------------
91 # The theme to use for HTML and HTML Help pages. See the documentation for
92 # a list of builtin themes.
93 html_theme = 'odoodoc'
95 # Theme options are theme-specific and customize the look and feel of a theme
96 # further. For a list of options available for each theme, see the
98 #html_theme_options = {}
100 # Add any paths that contain custom themes here, relative to this directory.
101 html_theme_path = ['_themes']
103 # The name for this set of Sphinx documents. If None, it defaults to
104 # "<project> v<release> documentation".
107 # A shorter title for the navigation bar. Default is the same as html_title.
108 #html_short_title = None
110 # The name of an image file (relative to this directory) to place at the top
114 # The name of an image file (within the static path) to use as favicon of the
115 # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
119 # Add any paths that contain custom static files (such as style sheets) here,
120 # relative to this directory. They are copied after the builtin static files,
121 # so a file named "default.css" will overwrite the builtin "default.css".
122 html_static_path = ['_static']
124 html_style = "odoo.css"
126 html_add_permalinks = False
128 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
129 # using the given strftime format.
130 #html_last_updated_fmt = '%b %d, %Y'
132 # If true, SmartyPants will be used to convert quotes and dashes to
133 # typographically correct entities.
134 #html_use_smartypants = True
136 # Custom sidebar templates, maps document names to template names.
137 # FIXME: no sidebar on index?
141 # Additional templates that should be rendered to pages, maps page names to
143 #html_additional_pages = {}
145 # If false, no module index is generated.
146 #html_domain_indices = True
148 # If false, no index is generated.
149 #html_use_index = True
151 # If true, the index is split into individual pages for each letter.
152 #html_split_index = False
154 # If true, links to the reST sources are added to the pages.
155 #html_show_sourcelink = True
157 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
158 #html_show_sphinx = True
160 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
161 #html_show_copyright = True
163 # If true, an OpenSearch description file will be output, and all pages will
164 # contain a <link> tag referring to it. The value of this option must be the
165 # base URL from which the finished HTML is served.
166 #html_use_opensearch = ''
168 intersphinx_mapping = {
169 'python': ('https://docs.python.org/2/', None),
170 'werkzeug': ('http://werkzeug.pocoo.org/docs/0.9/', None),
174 github_project = 'odoo'
177 app.connect('html-page-context', canonicalize)
178 app.add_config_value('canonical_root', None, 'env')
179 app.add_config_value('canonical_branch', 'master', 'env')
181 app.connect('html-page-context', versionize)
182 app.add_config_value('versions', '', 'env')
184 def canonicalize(app, pagename, templatename, context, doctree):
185 """ Adds a 'canonical' URL for the current document in the rendering
186 context. Requires the ``canonical_root`` setting being set. The canonical
187 branch is ``master`` but can be overridden using ``canonical_branch``.
189 if not app.config.canonical_root:
192 context['canonical'] = _build_url(
193 app.config.canonical_root, app.config.canonical_branch, pagename)
195 def versionize(app, pagename, templatename, context, doctree):
196 """ Adds a version switcher below the menu, requires ``canonical_root``
197 and ``versions`` (an ordered, space-separated lists of all possible
200 if not (app.config.canonical_root and app.config.versions):
203 context['versions'] = [
204 (vs, _build_url(app.config.canonical_root, vs, pagename))
205 for vs in app.config.versions.split(',')
206 if vs != app.config.version
209 def _build_url(root, branch, pagename):
210 return "{canonical_url}{canonical_branch}/{canonical_page}".format(
212 canonical_branch=branch,
213 canonical_page=(pagename + '.html').replace('index.html', '')
214 .replace('index/', ''),