Jonathan Neuschäfer | 5e48c75 | 2018-04-19 16:23:56 +0200 | [diff] [blame] | 1 | # -*- coding: utf-8 -*- |
Patrick Georgi | 5ce4001 | 2018-06-06 17:03:21 +0200 | [diff] [blame] | 2 | import subprocess |
Patrick Rudolph | 3931598 | 2018-10-22 10:52:40 +0200 | [diff] [blame] | 3 | from recommonmark.parser import CommonMarkParser |
Jonathan Neuschäfer | 5e48c75 | 2018-04-19 16:23:56 +0200 | [diff] [blame] | 4 | |
| 5 | # Add any paths that contain templates here, relative to this directory. |
| 6 | templates_path = ['_templates'] |
| 7 | |
| 8 | # The suffix(es) of source filenames. |
| 9 | source_suffix = ['.md'] |
| 10 | |
| 11 | # The master toctree document. |
| 12 | master_doc = 'index' |
| 13 | |
| 14 | # General information about the project. |
| 15 | project = u'coreboot' |
Patrick Rudolph | 93ffe83 | 2018-05-13 16:18:36 +0200 | [diff] [blame] | 16 | copyright = u'CC-by 4.0 the coreboot project' |
Jonathan Neuschäfer | 5e48c75 | 2018-04-19 16:23:56 +0200 | [diff] [blame] | 17 | author = u'the coreboot project' |
| 18 | |
| 19 | # The version info for the project you're documenting, acts as replacement for |
| 20 | # |version| and |release|, also used in various other places throughout the |
| 21 | # built documents. |
| 22 | # |
Jonathan Neuschäfer | 5e48c75 | 2018-04-19 16:23:56 +0200 | [diff] [blame] | 23 | # The full version, including alpha/beta/rc tags. |
Arthur Heymans | 5eb2115 | 2018-07-25 11:45:52 +0200 | [diff] [blame] | 24 | release = subprocess.check_output(('git', 'describe')).decode("utf-8") |
Patrick Georgi | 5ce4001 | 2018-06-06 17:03:21 +0200 | [diff] [blame] | 25 | # The short X.Y version. |
| 26 | version = release.split("-")[0] |
Jonathan Neuschäfer | 5e48c75 | 2018-04-19 16:23:56 +0200 | [diff] [blame] | 27 | |
Patrick Georgi | a73317e | 2019-12-10 20:27:38 +0100 | [diff] [blame] | 28 | extensions = ['sphinxcontrib.ditaa'] |
| 29 | |
Jonathan Neuschäfer | 5e48c75 | 2018-04-19 16:23:56 +0200 | [diff] [blame] | 30 | # The language for content autogenerated by Sphinx. Refer to documentation |
| 31 | # for a list of supported languages. |
| 32 | # |
| 33 | # This is also used if you do content translation via gettext catalogs. |
| 34 | # Usually you set "language" from the command line for these cases. |
| 35 | language = None |
| 36 | |
| 37 | # List of patterns, relative to source directory, that match files and |
| 38 | # directories to ignore when looking for source files. |
| 39 | # This patterns also effect to html_static_path and html_extra_path |
| 40 | exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] |
| 41 | |
| 42 | # The name of the Pygments (syntax highlighting) style to use. |
| 43 | pygments_style = 'sphinx' |
| 44 | |
| 45 | # A list of ignored prefixes for module index sorting. |
| 46 | # modindex_common_prefix = [] |
| 47 | |
| 48 | # If true, keep warnings as "system message" paragraphs in the built documents. |
| 49 | # keep_warnings = False |
| 50 | |
| 51 | # If true, `todo` and `todoList` produce output, else they produce nothing. |
| 52 | todo_include_todos = False |
| 53 | |
| 54 | |
| 55 | # -- Options for HTML output ---------------------------------------------- |
| 56 | |
| 57 | # The theme to use for HTML and HTML Help pages. See the documentation for |
| 58 | # a list of builtin themes. |
| 59 | # |
| 60 | html_theme = 'sphinx_rtd_theme' |
| 61 | |
| 62 | # Add any paths that contain custom static files (such as style sheets) here, |
| 63 | # relative to this directory. They are copied after the builtin static files, |
| 64 | # so a file named "default.css" will overwrite the builtin "default.css". |
Patrick Rudolph | a78e66e5 | 2018-05-13 16:06:51 +0200 | [diff] [blame] | 65 | html_static_path = ['_static'] |
| 66 | |
| 67 | html_context = { |
| 68 | 'css_files': [ |
| 69 | '_static/theme_overrides.css', # override wide tables in RTD theme |
| 70 | ], |
| 71 | } |
Jonathan Neuschäfer | 5e48c75 | 2018-04-19 16:23:56 +0200 | [diff] [blame] | 72 | |
| 73 | # Output file base name for HTML help builder. |
| 74 | htmlhelp_basename = 'corebootdoc' |
| 75 | |
| 76 | # -- Options for LaTeX output --------------------------------------------- |
| 77 | |
| 78 | latex_elements = { |
| 79 | # The paper size ('letterpaper' or 'a4paper'). |
| 80 | # |
| 81 | # 'papersize': 'letterpaper', |
| 82 | |
| 83 | # The font size ('10pt', '11pt' or '12pt'). |
| 84 | # |
| 85 | # 'pointsize': '10pt', |
| 86 | |
| 87 | # Additional stuff for the LaTeX preamble. |
| 88 | # |
| 89 | # 'preamble': '', |
| 90 | |
| 91 | # Latex figure (float) alignment |
| 92 | # |
| 93 | # 'figure_align': 'htbp', |
| 94 | } |
| 95 | |
| 96 | # Grouping the document tree into LaTeX files. List of tuples |
| 97 | # (source start file, target name, title, |
| 98 | # author, documentclass [howto, manual, or own class]). |
| 99 | latex_documents = [ |
| 100 | (master_doc, 'coreboot.tex', u'coreboot Documentation', |
| 101 | u'the coreboot project', 'manual'), |
| 102 | ] |
| 103 | |
| 104 | # The name of an image file (relative to this directory) to place at the top of |
| 105 | # the title page. |
| 106 | # |
| 107 | # latex_logo = None |
| 108 | |
| 109 | # For "manual" documents, if this is true, then toplevel headings are parts, |
| 110 | # not chapters. |
| 111 | # |
| 112 | # latex_use_parts = False |
| 113 | |
| 114 | # If true, show page references after internal links. |
| 115 | # |
| 116 | # latex_show_pagerefs = False |
| 117 | |
| 118 | # If true, show URL addresses after external links. |
| 119 | # |
| 120 | # latex_show_urls = False |
| 121 | |
| 122 | # Documents to append as an appendix to all manuals. |
| 123 | # |
| 124 | # latex_appendices = [] |
| 125 | |
Elyes HAOUAS | 89011be | 2018-05-29 08:31:10 +0200 | [diff] [blame] | 126 | # If false, will not define \strong, \code, itleref, \crossref ... but only |
Jonathan Neuschäfer | 5e48c75 | 2018-04-19 16:23:56 +0200 | [diff] [blame] | 127 | # \sphinxstrong, ..., \sphinxtitleref, ... To help avoid clash with user added |
| 128 | # packages. |
| 129 | # |
| 130 | # latex_keep_old_macro_names = True |
| 131 | |
| 132 | # If false, no module index is generated. |
| 133 | # |
| 134 | # latex_domain_indices = True |
| 135 | |
| 136 | |
| 137 | # -- Options for manual page output --------------------------------------- |
| 138 | |
| 139 | # One entry per manual page. List of tuples |
| 140 | # (source start file, name, description, authors, manual section). |
| 141 | man_pages = [ |
| 142 | (master_doc, 'coreboot', u'coreboot Documentation', |
| 143 | [author], 1) |
| 144 | ] |
| 145 | |
| 146 | # If true, show URL addresses after external links. |
| 147 | # |
| 148 | # man_show_urls = False |
| 149 | |
| 150 | |
| 151 | # -- Options for Texinfo output ------------------------------------------- |
| 152 | |
| 153 | # Grouping the document tree into Texinfo files. List of tuples |
| 154 | # (source start file, target name, title, author, |
| 155 | # dir menu entry, description, category) |
| 156 | texinfo_documents = [ |
| 157 | (master_doc, 'coreboot', u'coreboot Documentation', |
| 158 | author, 'coreboot', 'One line description of project.', |
| 159 | 'Miscellaneous'), |
| 160 | ] |
| 161 | |
Patrick Rudolph | 3931598 | 2018-10-22 10:52:40 +0200 | [diff] [blame] | 162 | enable_auto_toc_tree = True |
| 163 | |
| 164 | class MyCommonMarkParser(CommonMarkParser): |
| 165 | # remove this hack once upsteam RecommonMark supports inline code |
| 166 | def visit_code(self, mdnode): |
| 167 | from docutils import nodes |
| 168 | n = nodes.literal(mdnode.literal, mdnode.literal) |
| 169 | self.current_node.append(n) |
Jonathan Neuschäfer | 5e48c75 | 2018-04-19 16:23:56 +0200 | [diff] [blame] | 170 | |
| 171 | # Documents to append as an appendix to all manuals. |
| 172 | # |
| 173 | # texinfo_appendices = [] |
| 174 | |
| 175 | # If false, no module index is generated. |
| 176 | # |
| 177 | # texinfo_domain_indices = True |
| 178 | |
| 179 | # How to display URL addresses: 'footnote', 'no', or 'inline'. |
| 180 | # |
| 181 | # texinfo_show_urls = 'footnote' |
| 182 | |
| 183 | # If true, do not generate a @detailmenu in the "Top" node's menu. |
| 184 | # |
| 185 | # texinfo_no_detailmenu = False |
| 186 | |
Jonathan Neuschäfer | 5e48c75 | 2018-04-19 16:23:56 +0200 | [diff] [blame] | 187 | |
| 188 | def setup(app): |
| 189 | from recommonmark.transform import AutoStructify |
Patrick Rudolph | 3931598 | 2018-10-22 10:52:40 +0200 | [diff] [blame] | 190 | app.add_source_parser('.md', MyCommonMarkParser) |
| 191 | |
Jonathan Neuschäfer | 5e48c75 | 2018-04-19 16:23:56 +0200 | [diff] [blame] | 192 | app.add_config_value('recommonmark_config', { |
| 193 | 'enable_auto_toc_tree': True, |
Tom Hiller | ffe6d54 | 2018-07-28 17:38:54 -0400 | [diff] [blame] | 194 | 'enable_auto_doc_ref': False, # broken in Sphinx 1.6+ |
Philipp Deppenwiese | 57df088 | 2018-05-09 12:07:38 +0200 | [diff] [blame] | 195 | 'enable_eval_rst': True, |
Jonathan Neuschäfer | 5e48c75 | 2018-04-19 16:23:56 +0200 | [diff] [blame] | 196 | 'url_resolver': lambda url: '/' + url |
| 197 | }, True) |
| 198 | app.add_transform(AutoStructify) |