| 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 | sys.path.insert(0, os.path.abspath('exts')) |
| 19 | |
| 20 | |
| 21 | # -- Project information ----------------------------------------------------- |
| 22 | |
| 23 | project = 'Qt Material' |
| 24 | copyright = '2019, Yeison Cardona' |
| 25 | author = 'Yeison Cardona' |
| 26 | |
| 27 | # The short X.Y version |
| 28 | version = '' |
| 29 | # The full version, including alpha/beta/rc tags |
| 30 | release = '' |
| 31 | |
| 32 | |
| 33 | # -- General configuration --------------------------------------------------- |
| 34 | |
| 35 | # If your documentation needs a minimal Sphinx version, state it here. |
| 36 | # |
| 37 | # needs_sphinx = '1.0' |
| 38 | |
| 39 | # Add any Sphinx extension module names here, as strings. They can be |
| 40 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom |
| 41 | # ones. |
| 42 | extensions = [ |
| 43 | 'sphinx.ext.autodoc', |
| 44 | 'sphinx.ext.napoleon', |
| 45 | 'sphinx.ext.coverage', |
| 46 | 'sphinx.ext.viewcode', |
| 47 | |
| 48 | 'sphinx.ext.autosectionlabel', |
| 49 | |
| 50 | 'sphinx.ext.todo', |
| 51 | |
| 52 | # 'micropython_code', |
| 53 | |
| 54 | 'IPython.sphinxext.ipython_console_highlighting', |
| 55 | ] |
| 56 | |
| 57 | naoleon_google_docstring = False |
| 58 | napoleon_numpy_docstring = True |
| 59 | napoleon_include_init_with_doc = True |
| 60 | napoleon_include_private_with_doc = True |
| 61 | napoleon_include_special_with_doc = True |
| 62 | napoleon_use_admonition_for_examples = False |
| 63 | napoleon_use_admonition_for_notes = False |
| 64 | napoleon_use_admonition_for_references = False |
| 65 | napoleon_use_ivar = False |
| 66 | napoleon_use_param = True |
| 67 | napoleon_use_rtype = True |
| 68 | |
| 69 | # Add any paths that contain templates here, relative to this directory. |
| 70 | templates_path = ['_templates'] |
| 71 | |
| 72 | # The suffix(es) of source filenames. |
| 73 | # You can specify multiple suffix as a list of string: |
| 74 | # |
| 75 | # source_suffix = ['.rst', '.md'] |
| 76 | source_suffix = '.rst' |
| 77 | |
| 78 | # The master toctree document. |
| 79 | master_doc = 'index' |
| 80 | |
| 81 | # The language for content autogenerated by Sphinx. Refer to documentation |
| 82 | # for a list of supported languages. |
| 83 | # |
| 84 | # This is also used if you do content translation via gettext catalogs. |
| 85 | # Usually you set "language" from the command line for these cases. |
| 86 | language = None |
| 87 | |
| 88 | # List of patterns, relative to source directory, that match files and |
| 89 | # directories to ignore when looking for source files. |
| 90 | # This pattern also affects html_static_path and html_extra_path. |
| 91 | exclude_patterns = [] |
| 92 | |
| 93 | # The name of the Pygments (syntax highlighting) style to use. |
| 94 | pygments_style = 'sphinx' |
| 95 | |
| 96 | |
| 97 | # -- Options for HTML output ------------------------------------------------- |
| 98 | |
| 99 | # The theme to use for HTML and HTML Help pages. See the documentation for |
| 100 | # a list of builtin themes. |
| 101 | # |
| 102 | html_theme = 'alabaster' |
| 103 | |
| 104 | # Theme options are theme-specific and customize the look and feel of a theme |
| 105 | # further. For a list of options available for each theme, see the |
| 106 | # documentation. |
| 107 | # |
| 108 | html_theme_options = { |
| 109 | 'page_width': '1080px', |
| 110 | 'sidebar_width': '290px', |
| 111 | |
| 112 | # 'fixed_sidebar': True, |
| 113 | |
| 114 | # 'show_relbars': True, |
| 115 | # 'show_relbar_bottom': True, |
| 116 | |
| 117 | |
| 118 | # 'github_user': 'bitprophet', |
| 119 | # 'github_repo': 'alabaster', |
| 120 | } |
| 121 | |
| 122 | |
| 123 | # Add any paths that contain custom static files (such as style sheets) here, |
| 124 | # relative to this directory. They are copied after the builtin static files, |
| 125 | # so a file named "default.css" will overwrite the builtin "default.css". |
| 126 | html_static_path = ['_static'] |
| 127 | |
| 128 | # Custom sidebar templates, must be a dictionary that maps document names |
| 129 | # to template names. |
| 130 | # |
| 131 | # The default sidebars (for documents that don't match any pattern) are |
| 132 | # defined by theme itself. Builtin themes are using these templates by |
| 133 | # default: ``['localtoc.html', 'relations.html', 'sourcelink.html', |
| 134 | # 'searchbox.html']``. |
| 135 | # |
| 136 | html_sidebars = { |
| 137 | '**': [ |
| 138 | # 'about.html', |
| 139 | # 'globaltoc.html', |
| 140 | # 'navigation.html', |
| 141 | 'relations.html', |
| 142 | # sourcelink.html |
| 143 | 'searchbox.html', |
| 144 | # 'donate.html', |
| 145 | ] |
| 146 | } |
| 147 | |
| 148 | |
| 149 | # -- Options for HTMLHelp output --------------------------------------------- |
| 150 | |
| 151 | # Output file base name for HTML help builder. |
| 152 | htmlhelp_basename = 'QtMaterialdoc' |
| 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, 'QtMaterial.tex', 'Qt Material Documentation', |
| 180 | 'Yeison Cardona', '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, 'qtmaterial', 'Qt Material Documentation', |
| 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, 'QtMaterial', 'Qt Material Documentation', |
| 201 | author, 'QtMaterial', 'One line description of project.', |
| 202 | 'Miscellaneous'), |
| 203 | ] |
| 204 | |
| 205 | |
| 206 | # -- Options for Epub output ------------------------------------------------- |
| 207 | |
| 208 | # Bibliographic Dublin Core info. |
| 209 | epub_title = project |
| 210 | |
| 211 | # The unique identifier of the text. This can be a ISBN number |
| 212 | # or the project homepage. |
| 213 | # |
| 214 | # epub_identifier = '' |
| 215 | |
| 216 | # A unique identification for the text. |
| 217 | # |
| 218 | # epub_uid = '' |
| 219 | |
| 220 | # A list of files that should not be packed into the epub file. |
| 221 | epub_exclude_files = ['search.html'] |
| 222 | |
| 223 | |
| 224 | # -- Extension configuration ------------------------------------------------- |
| 225 | |
| 226 | autodoc_mock_imports = [ |
| 227 | |
| 228 | 'IPython' |
| 229 | |
| 230 | ] |
| 231 | |
| 232 | todo_include_todos = True |
| 233 | |
| 234 | |
| 235 | html_logo = '_static/logo.png' |
| 236 | html_favicon = '_static/favico.ico' |
| 237 | |
| 238 | autodoc_default_flags = [ |
| 239 | 'members', |
| 240 | 'no-undoc-members', |
| 241 | 'show-inheritance', |
| 242 | ] |
| 243 | |
| 244 | |
| 245 | def setup(app): |
| 246 | app.add_css_file("custom.css") |
| 247 | |
| 248 | |
| 249 | highlight_language = 'none' |
| 250 | html_sourcelink_suffix = '' |
| 251 | |
| 252 | # nbsphinx_execute_arguments = [ |
| 253 | # "--InlineBackend.figure_formats={'svg', 'pdf'}", |
| 254 | # "--InlineBackend.rc={'figure.dpi': 96}", |
| 255 | # ] |
| 256 | |
| 257 | nbsphinx_execute = 'never' |
| 258 | # nbsphinx_input_prompt = ' ' |
| 259 | # nbsphinx_output_prompt = ' ' |
| 260 | nbsphinx_kernel_name = 'python3' |
| 261 | nbsphinx_prompt_width = '0' |
| 262 | |
| 263 | |
| 264 | nbsphinx_prolog = """ |
| 265 | .. raw:: html |
| 266 | |
| 267 | <style> |
| 268 | .nbinput .prompt, |
| 269 | .nboutput .prompt { |
| 270 | display: none; |
| 271 | } |
| 272 | </style> |
| 273 | """ |
| 274 | |
| 275 | notebooks_dir = 'notebooks' |
| 276 | |
| 277 | notebooks_list = os.listdir(os.path.join( |
| 278 | os.path.abspath(os.path.dirname(__file__)), notebooks_dir)) |
| 279 | notebooks_list = filter(lambda s: not s.startswith('__'), notebooks_list) |
| 280 | |
| 281 | notebooks = [] |
| 282 | for notebook in notebooks_list: |
| 283 | if notebook not in ['readme.ipynb', 'license.ipynb'] and notebook.endswith('.ipynb'): |
| 284 | notebooks.append(f"{notebooks_dir}/{notebook.replace('.ipynb', '')}") |
| 285 | |
| 286 | notebooks = '\n '.join(sorted(notebooks)) |
| 287 | |
| 288 | with open('index.rst', 'w') as file: |
| 289 | file.write(f""" |
| 290 | |
| 291 | .. include:: {notebooks_dir}/readme.rst |
| 292 | |
| 293 | Navigation |
| 294 | ---------- |
| 295 | |
| 296 | .. toctree:: |
| 297 | :maxdepth: 2 |
| 298 | :name: mastertoc |
| 299 | |
| 300 | {notebooks} |
| 301 | |
| 302 | Indices and tables |
| 303 | ------------------ |
| 304 | |
| 305 | * :ref:`genindex` |
| 306 | * :ref:`modindex` |
| 307 | * :ref:`search` |
| 308 | |
| 309 | """) |