]> git.madduck.net Git - etc/vim.git/blob - docs/conf.py

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Self-host PyPI-related badges
[etc/vim.git] / docs / 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/stable/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 import ast
16 from pathlib import Path
17 import re
18 import string
19
20 from recommonmark.parser import CommonMarkParser
21
22
23 CURRENT_DIR = Path(__file__).parent
24
25
26 def get_version():
27     black_py = CURRENT_DIR / '..' / 'black.py'
28     _version_re = re.compile(r'__version__\s+=\s+(?P<version>.*)')
29     with open(str(black_py), 'r', encoding='utf8') as f:
30         version = _version_re.search(f.read()).group('version')
31     return str(ast.literal_eval(version))
32
33
34 def make_pypi_svg(version):
35     template = CURRENT_DIR / '_static' / 'pypi_template.svg'
36     target = CURRENT_DIR / '_static' / 'pypi.svg'
37     with open(str(template), 'r', encoding='utf8') as f:
38         svg = string.Template(f.read()).substitute(version=version)
39     with open(str(target), 'w', encoding='utf8') as f:
40         f.write(svg)
41
42
43 # -- Project information -----------------------------------------------------
44
45 project = 'Black'
46 copyright = '2018, Łukasz Langa and contributors to Black'
47 author = 'Łukasz Langa and contributors to Black'
48
49 # Autopopulate version
50 # The full version, including alpha/beta/rc tags.
51 release = get_version()
52 # The short X.Y version.
53 version = release
54 for sp in 'abcfr':
55     version = version.split(sp)[0]
56 make_pypi_svg(release)
57
58
59 # -- General configuration ---------------------------------------------------
60
61 # If your documentation needs a minimal Sphinx version, state it here.
62 #
63 # needs_sphinx = '1.0'
64
65 # Add any Sphinx extension module names here, as strings. They can be
66 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
67 # ones.
68 extensions = [
69     'sphinx.ext.autodoc',
70     'sphinx.ext.intersphinx',
71 ]
72
73 # Add any paths that contain templates here, relative to this directory.
74 templates_path = ['_templates']
75
76 source_parsers = {
77     '.md': CommonMarkParser,
78 }
79
80 # The suffix(es) of source filenames.
81 # You can specify multiple suffix as a list of string:
82 source_suffix = ['.rst', '.md']
83
84 # The master toctree document.
85 master_doc = 'index'
86
87 # The language for content autogenerated by Sphinx. Refer to documentation
88 # for a list of supported languages.
89 #
90 # This is also used if you do content translation via gettext catalogs.
91 # Usually you set "language" from the command line for these cases.
92 language = None
93
94 # List of patterns, relative to source directory, that match files and
95 # directories to ignore when looking for source files.
96 # This pattern also affects html_static_path and html_extra_path .
97 exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
98
99 # The name of the Pygments (syntax highlighting) style to use.
100 pygments_style = 'sphinx'
101
102
103 # -- Options for HTML output -------------------------------------------------
104
105 # The theme to use for HTML and HTML Help pages.  See the documentation for
106 # a list of builtin themes.
107 #
108 html_theme = 'alabaster'
109
110 html_sidebars = {
111     '**': [
112         'about.html',
113         'navigation.html',
114         'relations.html',
115         'sourcelink.html',
116         'searchbox.html'
117     ]
118 }
119
120 html_theme_options = {
121     'show_related': False,
122     'description': '“Any color you like.”',
123     'github_button': True,
124     'github_user': 'ambv',
125     'github_repo': 'black',
126     'github_type': 'star',
127     'show_powered_by': True,
128     'fixed_sidebar': True,
129     'logo': 'logo2.png',
130 }
131
132
133 # Add any paths that contain custom static files (such as style sheets) here,
134 # relative to this directory. They are copied after the builtin static files,
135 # so a file named "default.css" will overwrite the builtin "default.css".
136 html_static_path = ['_static']
137
138 # Custom sidebar templates, must be a dictionary that maps document names
139 # to template names.
140 #
141 # The default sidebars (for documents that don't match any pattern) are
142 # defined by theme itself.  Builtin themes are using these templates by
143 # default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
144 # 'searchbox.html']``.
145 #
146 # html_sidebars = {}
147
148
149 # -- Options for HTMLHelp output ---------------------------------------------
150
151 # Output file base name for HTML help builder.
152 htmlhelp_basename = 'blackdoc'
153
154
155 # -- Options for LaTeX output ------------------------------------------------
156
157 latex_elements = {
158     # The paper size ('letterpaper' or 'a4paper').
159     #
160     # 'papersize': 'letterpaper',
161
162     # The font size ('10pt', '11pt' or '12pt').
163     #
164     # 'pointsize': '10pt',
165
166     # Additional stuff for the LaTeX preamble.
167     #
168     # 'preamble': '',
169
170     # Latex figure (float) alignment
171     #
172     # 'figure_align': 'htbp',
173 }
174
175 # Grouping the document tree into LaTeX files. List of tuples
176 # (source start file, target name, title,
177 #  author, documentclass [howto, manual, or own class]).
178 latex_documents = [
179     (master_doc, 'black.tex', 'Documentation for Black',
180      'Łukasz Langa and contributors to Black', 'manual'),
181 ]
182
183
184 # -- Options for manual page output ------------------------------------------
185
186 # One entry per manual page. List of tuples
187 # (source start file, name, description, authors, manual section).
188 man_pages = [
189     (master_doc, 'black', 'Documentation for Black',
190      [author], 1)
191 ]
192
193
194 # -- Options for Texinfo output ----------------------------------------------
195
196 # Grouping the document tree into Texinfo files. List of tuples
197 # (source start file, target name, title, author,
198 #  dir menu entry, description, category)
199 texinfo_documents = [
200     (master_doc, 'Black', 'Documentation for Black',
201      author, 'Black', 'The uncompromising Python code formatter',
202      'Miscellaneous'),
203 ]
204
205
206 # -- Options for Epub output -------------------------------------------------
207
208 # Bibliographic Dublin Core info.
209 epub_title = project
210 epub_author = author
211 epub_publisher = author
212 epub_copyright = copyright
213
214 # The unique identifier of the text. This can be a ISBN number
215 # or the project homepage.
216 #
217 # epub_identifier = ''
218
219 # A unique identification for the text.
220 #
221 # epub_uid = ''
222
223 # A list of files that should not be packed into the epub file.
224 epub_exclude_files = ['search.html']
225
226
227 # -- Extension configuration -------------------------------------------------
228
229 # -- Options for intersphinx extension ---------------------------------------
230
231 # Example configuration for intersphinx: refer to the Python standard library.
232 intersphinx_mapping = {'https://docs.python.org/3/': None}