Mercurial > hgrepos > Python > libs > ConfigMix
comparison docs/conf.py @ 215:ab3d0326419c
Doc: Move the "doc" to "docs"
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Wed, 08 May 2019 09:23:37 +0200 |
| parents | doc/conf.py@b5ce9a8461bf |
| children | 13711ba8e81e |
comparison
equal
deleted
inserted
replaced
| 214:a35b0ca8b81f | 215:ab3d0326419c |
|---|---|
| 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 datetime | |
| 16 import os | |
| 17 import sys | |
| 18 sys.path.insert(0, os.path.dirname(os.path.abspath('.'))) | |
| 19 | |
| 20 import configmix | |
| 21 from configmix.compat import u | |
| 22 | |
| 23 | |
| 24 # -- Project information ----------------------------------------------------- | |
| 25 | |
| 26 project = 'ConfigMix' | |
| 27 copyright = u('2015–2019, Franz Glasner. All rights reserved') | |
| 28 author = 'Franz Glasner' | |
| 29 | |
| 30 # The short X.Y version | |
| 31 version = '.'.join(configmix.__version__.split('.')[:2]) | |
| 32 # The full version, including alpha/beta/rc tags | |
| 33 release = configmix.__version__ | |
| 34 release_date = configmix.__date__ | |
| 35 | |
| 36 today = datetime.date.today().isoformat() | |
| 37 | |
| 38 | |
| 39 # -- General configuration --------------------------------------------------- | |
| 40 | |
| 41 # If your documentation needs a minimal Sphinx version, state it here. | |
| 42 # | |
| 43 # needs_sphinx = '1.0' | |
| 44 | |
| 45 # Add any Sphinx extension module names here, as strings. They can be | |
| 46 # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom | |
| 47 # ones. | |
| 48 extensions = [ | |
| 49 'sphinx.ext.autodoc', | |
| 50 'sphinx.ext.intersphinx', | |
| 51 'sphinx.ext.todo', | |
| 52 'sphinx.ext.ifconfig', | |
| 53 # 'sphinx.ext.viewcode', | |
| 54 'changelog', | |
| 55 ] | |
| 56 | |
| 57 # Add any paths that contain templates here, relative to this directory. | |
| 58 templates_path = ['_templates'] | |
| 59 | |
| 60 # The suffix(es) of source filenames. | |
| 61 # You can specify multiple suffix as a list of string: | |
| 62 # | |
| 63 # source_suffix = ['.rst', '.md'] | |
| 64 source_suffix = '.rst' | |
| 65 | |
| 66 # The master toctree document. | |
| 67 master_doc = 'index' | |
| 68 | |
| 69 # The language for content autogenerated by Sphinx. Refer to documentation | |
| 70 # for a list of supported languages. | |
| 71 # | |
| 72 # This is also used if you do content translation via gettext catalogs. | |
| 73 # Usually you set "language" from the command line for these cases. | |
| 74 language = 'en' | |
| 75 | |
| 76 # List of patterns, relative to source directory, that match files and | |
| 77 # directories to ignore when looking for source files. | |
| 78 # This pattern also affects html_static_path and html_extra_path . | |
| 79 exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] | |
| 80 | |
| 81 # The name of the Pygments (syntax highlighting) style to use. | |
| 82 pygments_style = 'sphinx' | |
| 83 | |
| 84 | |
| 85 # -- Options for HTML output ------------------------------------------------- | |
| 86 | |
| 87 # The theme to use for HTML and HTML Help pages. See the documentation for | |
| 88 # a list of builtin themes. | |
| 89 # | |
| 90 #html_theme = 'alabaster' | |
| 91 html_theme = 'haiku' | |
| 92 # for the Haiku title | |
| 93 html_short_title = u("%s %s") % (project, release) | |
| 94 html_last_updated_fmt = "%s (rev %s)" % (today, configmix.__revision__) | |
| 95 | |
| 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 | |
| 98 # documentation. | |
| 99 # | |
| 100 # html_theme_options = {} | |
| 101 | |
| 102 # Add any paths that contain custom static files (such as style sheets) here, | |
| 103 # relative to this directory. They are copied after the builtin static files, | |
| 104 # so a file named "default.css" will overwrite the builtin "default.css". | |
| 105 html_static_path = ['_static'] | |
| 106 | |
| 107 # Custom sidebar templates, must be a dictionary that maps document names | |
| 108 # to template names. | |
| 109 # | |
| 110 # The default sidebars (for documents that don't match any pattern) are | |
| 111 # defined by theme itself. Builtin themes are using these templates by | |
| 112 # default: ``['localtoc.html', 'relations.html', 'sourcelink.html', | |
| 113 # 'searchbox.html']``. | |
| 114 # | |
| 115 # html_sidebars = {} | |
| 116 | |
| 117 html_show_sourcelink = False | |
| 118 | |
| 119 | |
| 120 # -- Options for HTMLHelp output --------------------------------------------- | |
| 121 | |
| 122 # Output file base name for HTML help builder. | |
| 123 htmlhelp_basename = 'ConfigMixdoc' | |
| 124 | |
| 125 | |
| 126 # -- Options for LaTeX output ------------------------------------------------ | |
| 127 | |
| 128 latex_elements = { | |
| 129 # The paper size ('letterpaper' or 'a4paper'). | |
| 130 # | |
| 131 'papersize': 'a4paper', | |
| 132 | |
| 133 # The font size ('10pt', '11pt' or '12pt'). | |
| 134 # | |
| 135 'pointsize': '11pt', | |
| 136 | |
| 137 # Additional stuff for the LaTeX preamble. | |
| 138 # | |
| 139 # NOTE: "inconsolata" in "fontpkg" errors within pdfTeX: seems to be | |
| 140 # incompatible with some header package. | |
| 141 # | |
| 142 'preamble': r''' | |
| 143 \usepackage{inconsolata} | |
| 144 ''', | |
| 145 | |
| 146 'fontpkg': r''' | |
| 147 \usepackage{charter} | |
| 148 \usepackage[defaultsans]{lato} | |
| 149 ''', | |
| 150 | |
| 151 # Latex figure (float) alignment | |
| 152 # | |
| 153 # 'figure_align': 'htbp', | |
| 154 # Use "Version" instead of "Release" on the title | |
| 155 'releasename': 'Version', | |
| 156 } | |
| 157 | |
| 158 # Grouping the document tree into LaTeX files. List of tuples | |
| 159 # (source start file, target name, title, | |
| 160 # author, documentclass [howto, manual, or own class]). | |
| 161 latex_documents = [ | |
| 162 (master_doc, 'ConfigMix.tex', '"ConfigMix" Documentation', | |
| 163 'Franz Glasner', 'manual', True), | |
| 164 ] | |
| 165 | |
| 166 latex_show_urls = 'footnote' | |
| 167 #latex_show_pagerefs = True | |
| 168 | |
| 169 | |
| 170 # -- Options for manual page output ------------------------------------------ | |
| 171 | |
| 172 # One entry per manual page. List of tuples | |
| 173 # (source start file, name, description, authors, manual section). | |
| 174 man_pages = [ | |
| 175 (master_doc, 'configmix', '"ConfigMix" Documentation', | |
| 176 [author], 1) | |
| 177 ] | |
| 178 | |
| 179 | |
| 180 # -- Options for Texinfo output ---------------------------------------------- | |
| 181 | |
| 182 # Grouping the document tree into Texinfo files. List of tuples | |
| 183 # (source start file, target name, title, author, | |
| 184 # dir menu entry, description, category) | |
| 185 texinfo_documents = [ | |
| 186 (master_doc, 'ConfigMix', '"ConfigMix" Documentation', | |
| 187 author, 'ConfigMix', 'One line description of project.', | |
| 188 'Miscellaneous'), | |
| 189 ] | |
| 190 | |
| 191 | |
| 192 # -- Extension configuration ------------------------------------------------- | |
| 193 | |
| 194 # -- Options for intersphinx extension --------------------------------------- | |
| 195 | |
| 196 # Example configuration for intersphinx: refer to the Python standard library. | |
| 197 intersphinx_mapping = {'https://docs.python.org/': None} | |
| 198 | |
| 199 # -- Options for todo extension ---------------------------------------------- | |
| 200 | |
| 201 # If true, `todo` and `todoList` produce output, else they produce nothing. | |
| 202 todo_include_todos = True | |
| 203 # Kein Link auf Pfad und Zeile | |
| 204 todo_link_only = True | |
| 205 | |
| 206 # -- Options for autodoc ----------------------------------------------------- | |
| 207 | |
| 208 autodoc_member_order = 'bysource' | |
| 209 autoclass_content = 'both' | |
| 210 | |
| 211 | |
| 212 # -- Options for changelog --------------------------------------------------- | |
| 213 | |
| 214 changelog_inner_tag_sort = ['breaking', 'feature', 'bugfix', 'misc', | |
| 215 'test', 'doc'] | |
| 216 | |
| 217 | |
| 218 def setup(app): | |
| 219 # | |
| 220 # Custom release_date variable with a custom substitution |release_date| | |
| 221 # | |
| 222 app.add_config_value('release_date', '', 'env') | |
| 223 | |
| 224 import sphinx.transforms | |
| 225 | |
| 226 class IAMCustomSubstitutions(sphinx.transforms.SphinxTransform): | |
| 227 | |
| 228 default_priority = sphinx.transforms.DefaultSubstitutions.default_priority | |
| 229 def apply(self): | |
| 230 from docutils import nodes | |
| 231 for ref in self.document.traverse(nodes.substitution_reference): | |
| 232 refname = ref['refname'] | |
| 233 if refname == 'release_date': | |
| 234 stext = self.config[refname] | |
| 235 ref.replace_self(nodes.Text(stext, stext)) | |
| 236 | |
| 237 app.add_transform(IAMCustomSubstitutions) |
