[ADD] pyqweb-specific stuff, pyqweb APIDoc
[odoo/odoo.git] / doc / conf.py
1 # -*- coding: utf-8 -*-
2 import sys, os
3 import sphinx
4
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__)
9 sys.path.append(
10     os.path.abspath(
11         os.path.join(DIR, '_themes')))
12 # autodoc
13 sys.path.append(os.path.abspath(os.path.join(DIR, '..')))
14
15 # -- General configuration -----------------------------------------------------
16
17 # If your documentation needs a minimal Sphinx version, state it here.
18 needs_sphinx = '1.1'
19
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.
22 extensions = [
23     'sphinx.ext.todo',
24     'sphinx.ext.autodoc',
25     'sphinx.ext.intersphinx',
26     'odoodoc',
27     'patchqueue'
28 ]
29 if sphinx.__version__.split('.') >= ['1', '2']:
30     # linkcode is only available from Sphinx 1.2
31     extensions.insert(0, 'sphinx.ext.linkcode')
32
33
34 # Add any paths that contain templates here, relative to this directory.
35 templates_path = ['_templates']
36
37 # The suffix of source filenames.
38 source_suffix = '.rst'
39
40 # The encoding of source files.
41 #source_encoding = 'utf-8-sig'
42
43 # The master toctree document.
44 master_doc = 'index'
45
46 # General information about the project.
47 project = u'odoo developer documentation'
48 copyright = u'2014, OpenERP s.a.'
49
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
52 # built documents.
53 #
54 # The short X.Y version.
55 version = '8.0'
56 # The full version, including alpha/beta/rc tags.
57 release = '8.0b1'
58
59 # There are two options for replacing |today|: either, you set today to some
60 # non-false value, then it is used:
61 #today = ''
62 # Else, today_fmt is used as the format for a strftime call.
63 today_fmt = '%B %d, %Y'
64
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']
68
69 # The reST default role (used for this markup: `text`) to use for all documents.
70 #default_role = None
71
72 # If true, '()' will be appended to :func: etc. cross-reference text.
73 add_function_parentheses = True
74
75 # If true, the current module name will be prepended to all description
76 # unit titles (such as .. function::).
77 #add_module_names = True
78
79 # If true, sectionauthor and moduleauthor directives will be shown in the
80 # output. They are ignored by default.
81 #show_authors = False
82
83 # The name of the Pygments (syntax highlighting) style to use.
84 pygments_style = 'odoo'
85
86 # A list of ignored prefixes for module index sorting.
87 #modindex_common_prefix = []
88
89
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'
94
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
97 # documentation.
98 #html_theme_options = {}
99
100 # Add any paths that contain custom themes here, relative to this directory.
101 html_theme_path = ['_themes']
102
103 # The name for this set of Sphinx documents.  If None, it defaults to
104 # "<project> v<release> documentation".
105 #html_title = None
106
107 # A shorter title for the navigation bar.  Default is the same as html_title.
108 #html_short_title = None
109
110 # The name of an image file (relative to this directory) to place at the top
111 # of the sidebar.
112 #html_logo = None
113
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
116 # pixels large.
117 #html_favicon = None
118
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']
123
124 html_style = "odoo.css"
125
126 html_add_permalinks = False
127
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'
131
132 # If true, SmartyPants will be used to convert quotes and dashes to
133 # typographically correct entities.
134 #html_use_smartypants = True
135
136 # Custom sidebar templates, maps document names to template names.
137 # FIXME: no sidebar on index?
138 html_sidebars = {
139 }
140
141 # Additional templates that should be rendered to pages, maps page names to
142 # template names.
143 #html_additional_pages = {}
144
145 # If false, no module index is generated.
146 #html_domain_indices = True
147
148 # If false, no index is generated.
149 #html_use_index = True
150
151 # If true, the index is split into individual pages for each letter.
152 #html_split_index = False
153
154 # If true, links to the reST sources are added to the pages.
155 #html_show_sourcelink = True
156
157 # If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
158 #html_show_sphinx = True
159
160 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
161 #html_show_copyright = True
162
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 = ''
167
168 intersphinx_mapping = {
169     'python': ('https://docs.python.org/2/', None),
170     'werkzeug': ('http://werkzeug.pocoo.org/docs/0.9/', None),
171 }
172
173 github_user = 'odoo'
174 github_project = 'odoo'
175
176 def setup(app):
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')
180
181     app.connect('html-page-context', versionize)
182     app.add_config_value('versions', '', 'env')
183
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``.
188     """
189     if not app.config.canonical_root:
190         return
191
192     context['canonical'] = _build_url(
193         app.config.canonical_root, app.config.canonical_branch, pagename)
194
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
198     versions).
199     """
200     if not (app.config.canonical_root and app.config.versions):
201         return
202
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
207     ]
208
209 def _build_url(root, branch, pagename):
210     return "{canonical_url}{canonical_branch}/{canonical_page}".format(
211         canonical_url=root,
212         canonical_branch=branch,
213         canonical_page=(pagename + '.html').replace('index.html', '')
214                                            .replace('index/', ''),
215     )
216