Fix inaccuracy in signer protocol specification
[cacert-codedocs.git] / source / conf.py
1 # -*- coding: utf-8 -*-
2 #
3 # Configuration file for the Sphinx documentation builder.
4 #
5 # This file does only contain a selection of the most common options. For a
6 # full list see the documentation:
7 # http://www.sphinx-doc.org/en/master/config
8
9 # -- Path setup --------------------------------------------------------------
10
11 # If extensions (or modules to document with autodoc) are in another directory,
12 # add these directories to sys.path here. If the directory is relative to the
13 # documentation root, use os.path.abspath to make it absolute, like shown here.
14 #
15 from datetime import datetime
16 import os
17 import certifi
18 import requests
19 # import sys
20 # sys.path.insert(0, os.path.abspath('.'))
21
22 from git import repo
23 from docutils import nodes, utils
24
25 try:
26 print('Checking connection to infradocs.cacert.org')
27 requests.head('https://infradocs.cacert.org/')
28 print('Connection to infradocs.cacert.org OK')
29 except requests.exceptions.SSLError as err:
30 print('SSL Error. Adding CAcert certificates to Certifi store...')
31 cafile = certifi.where()
32 with open(os.path.join(
33 os.path.dirname(__file__), '..', 'cacert.pem'), 'rb') as infile:
34 cacertca = infile.read()
35 with open(cafile, 'ab') as outfile:
36 outfile.write(cacertca)
37
38 # -- Project information -----------------------------------------------------
39
40 project = 'CAcert code documentation'
41 copyright = '2018, CAcert development team'
42 author = 'CAcert development team'
43
44 # The short X.Y version
45 version = '0.1'
46 # The full version, including alpha/beta/rc tags
47 release = "{}-git:{} built:{}".format(
48 version, repo.Repo('..').git.describe('--always', '--dirty'),
49 datetime.utcnow().replace(microsecond=0))
50
51 # -- General configuration ---------------------------------------------------
52
53 # If your documentation needs a minimal Sphinx version, state it here.
54 #
55 # needs_sphinx = '1.0'
56
57 # Add any Sphinx extension module names here, as strings. They can be
58 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
59 # ones.
60 extensions = [
61 'sphinx.ext.intersphinx',
62 'sphinx.ext.extlinks',
63 'sphinx.ext.todo',
64 'sphinx.ext.ifconfig',
65 'sphinxcontrib.phpdomain',
66 'sphinxcontrib.blockdiag',
67 'sphinxcontrib.seqdiag',
68 ]
69
70 # Add any paths that contain templates here, relative to this directory.
71 templates_path = ['_templates']
72
73 # The suffix(es) of source filenames.
74 # You can specify multiple suffix as a list of string:
75 #
76 # source_suffix = ['.rst', '.md']
77 source_suffix = '.rst'
78
79 # The master toctree document.
80 master_doc = 'index'
81
82 # The language for content autogenerated by Sphinx. Refer to documentation
83 # for a list of supported languages.
84 #
85 # This is also used if you do content translation via gettext catalogs.
86 # Usually you set "language" from the command line for these cases.
87 language = None
88
89 # List of patterns, relative to source directory, that match files and
90 # directories to ignore when looking for source files.
91 # This pattern also affects html_static_path and html_extra_path.
92 exclude_patterns = []
93
94 # The name of the Pygments (syntax highlighting) style to use.
95 pygments_style = 'sphinx'
96
97
98 # -- Options for HTML output -------------------------------------------------
99
100 # The theme to use for HTML and HTML Help pages. See the documentation for
101 # a list of builtin themes.
102 #
103 html_theme = 'classic'
104
105 # Theme options are theme-specific and customize the look and feel of a theme
106 # further. For a list of options available for each theme, see the
107 # documentation.
108 #
109 html_theme_options = {
110 'sidebarbgcolor': '#f5f7f7',
111 'sidebartextcolor': '#334d55',
112 'sidebarlinkcolor': '#005fa9',
113 }
114
115 html_title = project + " v" + release
116
117 html_logo = os.path.join('images', 'CAcert-logo-colour.svg')
118
119 html_favicon = os.path.join('images', 'favicon.ico')
120
121 # Add any paths that contain custom static files (such as style sheets) here,
122 # relative to this directory. They are copied after the builtin static files,
123 # so a file named "default.css" will overwrite the builtin "default.css".
124 html_static_path = ['_static']
125
126 # Custom sidebar templates, must be a dictionary that maps document names
127 # to template names.
128 #
129 # The default sidebars (for documents that don't match any pattern) are
130 # defined by theme itself. Builtin themes are using these templates by
131 # default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
132 # 'searchbox.html']``.
133 #
134 # html_sidebars = {}
135
136
137 # -- Options for HTMLHelp output ---------------------------------------------
138
139 # Output file base name for HTML help builder.
140 htmlhelp_basename = 'CAcertcodedocumentationdoc'
141
142
143 # -- Options for LaTeX output ------------------------------------------------
144
145 latex_elements = {
146 # The paper size ('letterpaper' or 'a4paper').
147 #
148 # 'papersize': 'letterpaper',
149
150 # The font size ('10pt', '11pt' or '12pt').
151 #
152 # 'pointsize': '10pt',
153
154 # Additional stuff for the LaTeX preamble.
155 #
156 # 'preamble': '',
157
158 # Latex figure (float) alignment
159 #
160 # 'figure_align': 'htbp',
161 }
162
163 # Grouping the document tree into LaTeX files. List of tuples
164 # (source start file, target name, title,
165 # author, documentclass [howto, manual, or own class]).
166 latex_documents = [
167 (master_doc, 'CAcertcodedocumentation.tex', 'CAcert code documentation',
168 'CAcert development team', 'manual'),
169 ]
170
171
172 # -- Options for manual page output ------------------------------------------
173
174 # One entry per manual page. List of tuples
175 # (source start file, name, description, authors, manual section).
176 man_pages = [
177 (master_doc, 'cacertcodedocumentation', 'CAcert code documentation',
178 [author], 1)
179 ]
180
181
182 # -- Options for Texinfo output ----------------------------------------------
183
184 # Grouping the document tree into Texinfo files. List of tuples
185 # (source start file, target name, title, author,
186 # dir menu entry, description, category)
187 texinfo_documents = [
188 (master_doc, 'CAcertcodedocumentation', 'CAcert code documentation',
189 author, 'CAcertcodedocumentation', 'One line description of project.',
190 'Miscellaneous'),
191 ]
192
193
194 # -- Options for Epub output -------------------------------------------------
195
196 # Bibliographic Dublin Core info.
197 epub_title = project
198
199 # The unique identifier of the text. This can be a ISBN number
200 # or the project homepage.
201 #
202 # epub_identifier = ''
203
204 # A unique identification for the text.
205 #
206 # epub_uid = ''
207
208 # A list of files that should not be packed into the epub file.
209 epub_exclude_files = ['search.html']
210
211
212 # -- Extension configuration -------------------------------------------------
213
214 # -- Options for intersphinx extension ---------------------------------------
215
216 # Example configuration for intersphinx: refer to the Python standard library.
217 intersphinx_mapping = {'infradocs': ('https://infradocs.cacert.org', None)}
218
219 # -- Options for todo extension ----------------------------------------------
220
221 # If true, `todo` and `todoList` produce output, else they produce nothing.
222 todo_include_todos = True
223
224 extlinks = {
225 'wiki': ('https://wiki.cacert.org/%s', 'Wiki '),
226 'cacertgit': ('https://git.cacert.org/gitweb/?p=%s.git', 'CAcert Git repository '),
227 'github': ('https://github.com/CAcertOrg/%s', 'Github repository '),
228 }
229
230 def cacert_bug(name, rawtext, text, lineno, inliner, options={}, content=[]):
231 try:
232 bugnum = int(text)
233 if bugnum <= 0:
234 raise ValueError
235 except ValueError:
236 msg = inliner.reporter.error(
237 'Bug number must be a number greater than or equal to 1; '
238 '"%s" is invalid.' % text, line=lineno)
239 prb = inliner.problematic(rawtext, rawtext, msg)
240 return [prb], [msg]
241 ref = 'https://bugs.cacert.org/view.php?id=%d' % bugnum
242 node = nodes.reference(rawtext, '#' + utils.unescape(text), refuri=ref,
243 **options)
244 return [node], []
245
246
247 def setup(app):
248 app.add_role('bug', cacert_bug)