Anton Komlev | b813dbc | 2022-04-01 21:12:16 +0100 | [diff] [blame] | 1 | # -*- coding: utf-8 -*- |
| 2 | #------------------------------------------------------------------------------- |
| 3 | # Copyright (c) 2019-2022, Arm Limited. All rights reserved. |
Minos Galanakis | d19a19f | 2020-06-03 15:38:03 +0100 | [diff] [blame] | 4 | # |
| 5 | # SPDX-License-Identifier: BSD-3-Clause |
| 6 | # |
Anton Komlev | b813dbc | 2022-04-01 21:12:16 +0100 | [diff] [blame] | 7 | #------------------------------------------------------------------------------- |
| 8 | |
| 9 | # Configuration file for the Sphinx documentation builder. |
Minos Galanakis | d19a19f | 2020-06-03 15:38:03 +0100 | [diff] [blame] | 10 | # |
Anton Komlev | b813dbc | 2022-04-01 21:12:16 +0100 | [diff] [blame] | 11 | # This file does only contain a selection of the most common options. For a |
| 12 | # full list see the documentation: |
| 13 | # http://www.sphinx-doc.org/en/master/config |
| 14 | |
Minos Galanakis | d19a19f | 2020-06-03 15:38:03 +0100 | [diff] [blame] | 15 | import os |
| 16 | import sys |
Anton Komlev | b813dbc | 2022-04-01 21:12:16 +0100 | [diff] [blame] | 17 | import re |
| 18 | from subprocess import check_output |
Minos Galanakis | d19a19f | 2020-06-03 15:38:03 +0100 | [diff] [blame] | 19 | |
Anton Komlev | b813dbc | 2022-04-01 21:12:16 +0100 | [diff] [blame] | 20 | # -- Project information ----------------------------------------------------- |
Minos Galanakis | d19a19f | 2020-06-03 15:38:03 +0100 | [diff] [blame] | 21 | |
Anton Komlev | b813dbc | 2022-04-01 21:12:16 +0100 | [diff] [blame] | 22 | project = 'Trusted Firmware-M' |
| 23 | copyright = '2017-2022, ARM CE-OSS' |
| 24 | author = 'ARM CE-OSS' |
| 25 | title = 'User Guide' |
Minos Galanakis | d19a19f | 2020-06-03 15:38:03 +0100 | [diff] [blame] | 26 | |
Anton Komlev | b813dbc | 2022-04-01 21:12:16 +0100 | [diff] [blame] | 27 | # -- Extract current version ------------------------------------------------- |
Minos Galanakis | d19a19f | 2020-06-03 15:38:03 +0100 | [diff] [blame] | 28 | |
Anton Komlev | b813dbc | 2022-04-01 21:12:16 +0100 | [diff] [blame] | 29 | try: |
| 30 | vrex = re.compile(r'TF-M(?P<GIT_VERSION>v.+?)' |
| 31 | r'(-[0-9]+-g)?(?P<GIT_SHA>[a-f0-9]{7,})?$') |
Minos Galanakis | d19a19f | 2020-06-03 15:38:03 +0100 | [diff] [blame] | 32 | |
Anton Komlev | b813dbc | 2022-04-01 21:12:16 +0100 | [diff] [blame] | 33 | version = check_output("git describe --tags --always", |
| 34 | shell = True, encoding = 'UTF-8') |
| 35 | |
| 36 | _v = vrex.match(version) |
| 37 | release = _v.group('GIT_VERSION') |
| 38 | if _v.group('GIT_SHA'): |
| 39 | version = release + "+" + _v.group('GIT_SHA')[:7] |
| 40 | |
| 41 | except: |
| 42 | version = release = 'Unknown' |
| 43 | |
| 44 | # -- General configuration --------------------------------------------------- |
| 45 | |
| 46 | # If your documentation needs a minimal Sphinx version, state it here. |
| 47 | # |
| 48 | # needs_sphinx = '1.4' |
| 49 | |
| 50 | # Add any Sphinx extension module names here, as strings. They can be |
| 51 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom |
| 52 | # ones. |
| 53 | extensions = [ |
| 54 | 'sphinx.ext.imgmath', |
| 55 | 'm2r2', #Support markdown files. Needed for external code. |
| 56 | 'sphinx.ext.autosectionlabel', #Make sphinx generate a label for each section |
| 57 | 'sphinxcontrib.plantuml', #Add support for PlantUML drawings |
| 58 | 'sphinxcontrib.rsvgconverter', #Add support for SVG to PDF |
| 59 | 'sphinx_tabs.tabs' #Enable tab extension in Sphinx |
| 60 | ] |
| 61 | |
| 62 | # PlantUML |
| 63 | plantuml = 'java -jar ' + os.environ['PLANTUML_JAR_PATH'] |
| 64 | |
| 65 | #Make auso section labals generated be prefixed with file name. |
| 66 | autosectionlabel_prefix_document=True |
| 67 | #Add auso section label for level 2 headers only. |
| 68 | autosectionlabel_maxdepth=2 |
| 69 | |
| 70 | # Add any paths that contain templates here, relative to this directory. |
| 71 | templates_path = ['_templates'] |
| 72 | |
| 73 | # The suffix(es) of source filenames. |
| 74 | # You can specify multiple suffix as a list of string: |
| 75 | # |
| 76 | source_suffix = ['.rst', '.md'] |
| 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 = ['_build', 'Thumbs.db', '.DS_Store', 'readme.rst', |
| 92 | 'platform/ext/target/cypress/psoc64/security/keys/readme.rst', |
| 93 | 'lib/ext/**'] |
| 94 | |
| 95 | # The name of the Pygments (syntax highlighting) style to use. |
| 96 | pygments_style = 'sphinx' |
| 97 | |
| 98 | # -- Options for HTML output ------------------------------------------------- |
| 99 | |
| 100 | # The theme to use for HTML and HTML Help pages. See the documentation for |
| 101 | # a list of builtin themes. |
| 102 | # |
| 103 | html_theme = 'sphinx_rtd_theme' |
| 104 | |
| 105 | # Theme options are theme-specific and customize the look and feel of a theme |
| 106 | # further. For a list of options available for each theme, see the |
| 107 | # documentation. |
| 108 | # |
Anton Komlev | 8e44834 | 2022-04-06 10:19:35 +0100 | [diff] [blame^] | 109 | html_theme_options = { |
| 110 | 'collapse_navigation': False, |
| 111 | 'prev_next_buttons_location' : None # Hide Prev and Next buttons |
| 112 | # 'display_version': True, # Show version under logo |
| 113 | } |
| 114 | |
| 115 | # Remove the "View page source" link from the top of docs pages |
| 116 | html_show_sourcelink = False |
| 117 | |
Anton Komlev | b813dbc | 2022-04-01 21:12:16 +0100 | [diff] [blame] | 118 | # |
| 119 | # Add any paths that contain custom static files (such as style sheets) here, |
| 120 | # relative to configuration directory. They are copied after the builtin static |
| 121 | # files, so a file named "default.css" will overwrite the builtin "default.css". |
| 122 | html_static_path = ['_static'] |
| 123 | |
| 124 | # Set the documentation logo relative to configuration directory |
| 125 | html_logo = '_static/images/tf_logo_white.png' |
| 126 | |
Anton Komlev | 8e44834 | 2022-04-06 10:19:35 +0100 | [diff] [blame^] | 127 | # Set the documentation favicon |
| 128 | html_favicon = '_static/images/favicon.ico' |
| 129 | |
Anton Komlev | b813dbc | 2022-04-01 21:12:16 +0100 | [diff] [blame] | 130 | # Custom sidebar templates, must be a dictionary that maps document names |
| 131 | # to template names. |
| 132 | # |
| 133 | # The default sidebars (for documents that don't match any pattern) are |
| 134 | # defined by theme itself. Builtin themes are using these templates by |
| 135 | # default: ``['localtoc.html', 'relations.html', 'sourcelink.html', |
| 136 | # 'searchbox.html']``. |
| 137 | # |
| 138 | # html_sidebars = {} |
| 139 | |
| 140 | #Disable adding conf.py copyright notice to HTML output |
| 141 | html_show_copyright = False |
| 142 | |
Anton Komlev | 8e44834 | 2022-04-06 10:19:35 +0100 | [diff] [blame^] | 143 | # Disable showing Sphinx footer message: |
| 144 | # "Built with Sphinx using a theme provided by Read the Docs. " |
| 145 | html_show_sphinx = False |
| 146 | |
Anton Komlev | b813dbc | 2022-04-01 21:12:16 +0100 | [diff] [blame] | 147 | #Add custom css for HTML. Used to allow full page width rendering |
| 148 | def setup(app): |
| 149 | app.add_css_file('css/tfm_custom.css') |
| 150 | |
| 151 | # -- Options for HTMLHelp output --------------------------------------------- |
| 152 | |
| 153 | # Output file base name for HTML help builder. |
| 154 | htmlhelp_basename = 'TF-M doc' |
| 155 | |
| 156 | rst_prolog = """ |
| 157 | .. |TFM_VERSION| replace:: version |
| 158 | """ |
| 159 | |
| 160 | # Enable figures and tables auto numbering |
| 161 | numfig = True |
| 162 | numfig_secnum_depth = 0 |
| 163 | numfig_format = { |
| 164 | 'figure': 'Figure %s:', |
| 165 | 'table': 'Table %s:', |
| 166 | 'code-block': 'Listing %s:', |
| 167 | 'section': '%s' |
| 168 | } |
| 169 | |
| 170 | # -- Options for LaTeX output ------------------------------------------------ |
| 171 | |
| 172 | latex_elements = { |
| 173 | # The paper size ('letterpaper' or 'a4paper'). |
| 174 | # |
| 175 | # 'papersize': 'letterpaper', |
| 176 | |
| 177 | # The font size ('10pt', '11pt' or '12pt'). |
| 178 | # |
| 179 | # 'pointsize': '10pt', |
| 180 | |
| 181 | # Additional stuff for the LaTeX preamble. |
| 182 | # |
| 183 | # 'preamble': '', |
| 184 | |
| 185 | # Latex figure (float) alignment |
| 186 | # |
| 187 | # 'figure_align': 'htbp', |
| 188 | } |
| 189 | |
| 190 | # Grouping the document tree into LaTeX files. List of tuples |
| 191 | # (source start file, target name, title, |
| 192 | # author, documentclass [howto, manual, or own class]). |
| 193 | latex_documents = [ |
| 194 | (master_doc, 'TF-M.tex', title, |
| 195 | author, 'manual'), |
| 196 | ] |
| 197 | |
| 198 | # -- Options for manual page output ------------------------------------------ |
| 199 | |
| 200 | # One entry per manual page. List of tuples |
| 201 | # (source start file, name, description, authors, manual section). |
| 202 | #man_pages = [ |
| 203 | # (master_doc, 'tf-m', title, |
| 204 | # [author], 7) |
| 205 | #] |
| 206 | |
| 207 | # -- Options for Texinfo output ---------------------------------------------- |
| 208 | |
| 209 | # Grouping the document tree into Texinfo files. List of tuples |
| 210 | # (source start file, target name, title, author, |
| 211 | # dir menu entry, description, category) |
| 212 | #texinfo_documents = [ |
| 213 | # (master_doc, 'TF-M', title, |
| 214 | # author, 'TF-M', 'Trusted Firmware for Cortex-M', |
| 215 | # 'Miscellaneous'), |
| 216 | #] |
| 217 | |
| 218 | # -- Extension configuration ------------------------------------------------- |