Zack Williams | 071eda2 | 2019-05-15 18:19:51 -0700 | [diff] [blame] | 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 | # import os |
| 16 | # import sys |
| 17 | # sys.path.insert(0, os.path.abspath('.')) |
| 18 | |
| 19 | import os |
| 20 | |
| 21 | def get_version(): |
| 22 | with open("VERSION") as f: |
| 23 | return f.read().strip() |
| 24 | |
| 25 | # -- Project information ----------------------------------------------------- |
| 26 | |
| 27 | project = u'VOLTHA Docs' |
| 28 | copyright = u'2019, VOLTHA Contributors' |
| 29 | author = u'VOLTHA Contributors' |
| 30 | |
| 31 | # The short X.Y version |
| 32 | version = get_version() |
| 33 | |
| 34 | # The full version, including alpha/beta/rc tags |
| 35 | release = get_version() |
| 36 | |
| 37 | # -- General configuration --------------------------------------------------- |
| 38 | |
| 39 | # If your documentation needs a minimal Sphinx version, state it here. |
| 40 | # |
| 41 | # needs_sphinx = '1.0' |
| 42 | |
| 43 | # make all warnings errors |
| 44 | warning_is_error = True |
| 45 | |
| 46 | # Add any Sphinx extension module names here, as strings. They can be |
| 47 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom |
| 48 | # ones. |
| 49 | extensions = [ |
| 50 | 'recommonmark', |
| 51 | 'sphinx.ext.coverage', |
| 52 | 'sphinx.ext.graphviz', |
| 53 | 'sphinx.ext.ifconfig', |
| 54 | 'sphinx.ext.mathjax', |
| 55 | 'sphinx.ext.todo', |
| 56 | 'sphinxcontrib.actdiag', |
| 57 | 'sphinxcontrib.blockdiag', |
| 58 | 'sphinxcontrib.nwdiag', |
| 59 | 'sphinxcontrib.openapi', |
| 60 | 'sphinxcontrib.packetdiag', |
| 61 | 'sphinxcontrib.rackdiag', |
| 62 | 'sphinxcontrib.seqdiag', |
Zack Williams | c6460c2 | 2019-12-18 14:54:43 -0700 | [diff] [blame^] | 63 | 'sphinxcontrib.spelling', |
Zack Williams | 071eda2 | 2019-05-15 18:19:51 -0700 | [diff] [blame] | 64 | # 'sphinxcontrib.golangdomain', |
| 65 | # 'autoapi.extension', |
| 66 | ] |
| 67 | |
| 68 | # API documentation |
| 69 | # https://github.com/rtfd/sphinx-autoapi |
| 70 | # https://sphinx-autoapi.readthedocs.io |
| 71 | # autoapi_type = 'go' |
| 72 | # autoapi_dirs = [ |
| 73 | # 'voltha-go/cli/util', |
| 74 | # 'voltha-go/rw_core/config', |
| 75 | # 'voltha-go/rw_core/core', |
| 76 | # 'voltha-go/rw_core/graph', |
| 77 | # 'voltha-go/rw_core/utils', |
| 78 | # ] |
| 79 | |
Zack Williams | c6460c2 | 2019-12-18 14:54:43 -0700 | [diff] [blame^] | 80 | # Text files with lists of words that shouldn't fail the spellchecker: |
| 81 | spelling_word_list_filename=['dict.txt', ] |
| 82 | |
Zack Williams | 071eda2 | 2019-05-15 18:19:51 -0700 | [diff] [blame] | 83 | # Add any paths that contain templates here, relative to this directory. |
| 84 | templates_path = ['_templates'] |
| 85 | |
| 86 | # The suffix(es) of source filenames. |
| 87 | # You can specify multiple suffix as a list of string: |
| 88 | # |
| 89 | # source_suffix = ['.rst', '.md'] |
| 90 | source_suffix = ['.rst', '.md'] |
| 91 | |
| 92 | # The master toctree document. |
| 93 | master_doc = 'index' |
| 94 | |
| 95 | # The language for content autogenerated by Sphinx. Refer to documentation |
| 96 | # for a list of supported languages. |
| 97 | # |
| 98 | # This is also used if you do content translation via gettext catalogs. |
| 99 | # Usually you set "language" from the command line for these cases. |
| 100 | language = None |
| 101 | |
| 102 | # List of patterns, relative to source directory, that match files and |
| 103 | # directories to ignore when looking for source files. |
| 104 | # This pattern also affects html_static_path and html_extra_path. |
| 105 | exclude_patterns = [ |
| 106 | '*/LICENSE.md', |
| 107 | '*/vendor', |
| 108 | '.DS_Store', |
| 109 | 'Thumbs.db', |
| 110 | '_build', |
| 111 | 'doc_venv', |
| 112 | 'repos', |
| 113 | 'requirements.txt', |
| 114 | 'bbsim/README.md', |
Zack Williams | f239154 | 2019-12-11 15:49:19 -0700 | [diff] [blame] | 115 | 'CODE_OF_CONDUCT.md', |
| 116 | '*/CODE_OF_CONDUCT.md', |
Zack Williams | 071eda2 | 2019-05-15 18:19:51 -0700 | [diff] [blame] | 117 | ] |
| 118 | |
| 119 | # The name of the Pygments (syntax highlighting) style to use. |
| 120 | pygments_style = None |
| 121 | |
| 122 | # -- Options for HTML output ------------------------------------------------- |
| 123 | |
| 124 | # The theme to use for HTML and HTML Help pages. See the documentation for |
| 125 | # a list of builtin themes. |
| 126 | # |
| 127 | html_theme = 'sphinx_rtd_theme' |
| 128 | |
| 129 | # Theme options are theme-specific and customize the look and feel of a theme |
| 130 | # further. For a list of options available for each theme, see the |
| 131 | # documentation. |
| 132 | # |
| 133 | # html_theme_options = {} |
| 134 | |
| 135 | # Add any paths that contain custom static files (such as style sheets) here, |
| 136 | # relative to this directory. They are copied after the builtin static files, |
| 137 | # so a file named "default.css" will overwrite the builtin "default.css". |
| 138 | html_static_path = ['_static'] |
| 139 | |
| 140 | # Custom sidebar templates, must be a dictionary that maps document names |
| 141 | # to template names. |
| 142 | # |
| 143 | # The default sidebars (for documents that don't match any pattern) are |
| 144 | # defined by theme itself. Builtin themes are using these templates by |
| 145 | # default: ``['localtoc.html', 'relations.html', 'sourcelink.html', |
| 146 | # 'searchbox.html']``. |
| 147 | # |
| 148 | # html_sidebars = {} |
| 149 | |
| 150 | |
| 151 | # -- Options for HTMLHelp output --------------------------------------------- |
| 152 | |
| 153 | # Output file base name for HTML help builder. |
| 154 | htmlhelp_basename = 'VOLTHADocs' |
| 155 | |
| 156 | |
| 157 | # -- Options for LaTeX output ------------------------------------------------ |
| 158 | |
| 159 | latex_elements = { |
| 160 | # The paper size ('letterpaper' or 'a4paper'). |
| 161 | # |
| 162 | # 'papersize': 'letterpaper', |
| 163 | |
| 164 | # The font size ('10pt', '11pt' or '12pt'). |
| 165 | # |
| 166 | # 'pointsize': '10pt', |
| 167 | |
| 168 | # Additional stuff for the LaTeX preamble. |
| 169 | # |
| 170 | # 'preamble': '', |
| 171 | |
| 172 | # Latex figure (float) alignment |
| 173 | # |
| 174 | # 'figure_align': 'htbp', |
| 175 | } |
| 176 | |
| 177 | # Grouping the document tree into LaTeX files. List of tuples |
| 178 | # (source start file, target name, title, |
| 179 | # author, documentclass [howto, manual, or own class]). |
| 180 | latex_documents = [ |
| 181 | (master_doc, 'VOLTHADocs.tex', u'VOLTHA Docs', |
| 182 | u'VOLTHA Team', 'manual'), |
| 183 | ] |
| 184 | |
| 185 | |
| 186 | # -- Options for manual page output ------------------------------------------ |
| 187 | |
| 188 | # One entry per manual page. List of tuples |
| 189 | # (source start file, name, description, authors, manual section). |
| 190 | man_pages = [ |
| 191 | (master_doc, 'VOLTHA Docs', u'VOLTHA Docs', |
| 192 | [author], 1) |
| 193 | ] |
| 194 | |
| 195 | |
| 196 | # -- Options for Texinfo output ---------------------------------------------- |
| 197 | |
| 198 | # Grouping the document tree into Texinfo files. List of tuples |
| 199 | # (source start file, target name, title, author, |
| 200 | # dir menu entry, description, category) |
| 201 | texinfo_documents = [ |
| 202 | (master_doc, 'VOLTHA Docs', u'VOLTHA Docs', |
| 203 | author, 'VOLTHADocs', 'One line description of project.', |
| 204 | 'Miscellaneous'), |
| 205 | ] |
| 206 | |
| 207 | |
| 208 | # -- Options for Epub output ------------------------------------------------- |
| 209 | |
| 210 | # Bibliographic Dublin Core info. |
| 211 | epub_title = project |
| 212 | |
| 213 | # The unique identifier of the text. This can be a ISBN number |
| 214 | # or the project homepage. |
| 215 | # |
| 216 | # epub_identifier = '' |
| 217 | |
| 218 | # A unique identification for the text. |
| 219 | # |
| 220 | # epub_uid = '' |
| 221 | |
| 222 | # A list of files that should not be packed into the epub file. |
| 223 | epub_exclude_files = ['search.html'] |
| 224 | |
| 225 | |
| 226 | # -- Extension configuration ------------------------------------------------- |
| 227 | |
| 228 | # blockdiag/etc. config |
| 229 | |
| 230 | rackdiag_antialias = True |
| 231 | rackdiag_html_image_format = "SVG" |
| 232 | rackdiag_fontpath = [ |
| 233 | "_static/fonts/Inconsolata-Regular.ttf", |
| 234 | "_static/fonts/Inconsolata-Bold.ttf", |
| 235 | ] |
| 236 | |
| 237 | nwdiag_antialias = True |
| 238 | nwdiag_html_image_format = "SVG" |
| 239 | nwdiag_fontpath = [ |
| 240 | "_static/fonts/Inconsolata-Regular.ttf", |
| 241 | "_static/fonts/Inconsolata-Bold.ttf", |
| 242 | ] |
| 243 | |
| 244 | # -- Options for todo extension ---------------------------------------------- |
| 245 | # If true, `todo` and `todoList` produce output, else they produce nothing. |
| 246 | todo_include_todos = True |
| 247 | |
| 248 | # -- Configure recommonmark to use AutoStructify ----------------------------- |
| 249 | # Docs: https://recommonmark.readthedocs.io/en/latest/auto_structify.html |
| 250 | |
| 251 | import recommonmark |
| 252 | from recommonmark.transform import AutoStructify |
| 253 | |
| 254 | github_doc_root = 'https://github.com/opencord/voltha-docs' |
| 255 | |
| 256 | def setup(app): |
| 257 | |
| 258 | app.add_css_file('css/rtd_theme_mods.css') |
| 259 | |
| 260 | app.add_config_value('recommonmark_config', { |
| 261 | 'url_resolver': lambda url: github_doc_root + url, |
| 262 | 'auto_toc_tree_section': 'Contents', |
| 263 | }, True) |
| 264 | |
| 265 | app.add_transform(AutoStructify) |