Elena Uziunaite | bd4d7a9 | 2023-10-24 15:58:31 +0100 | [diff] [blame] | 1 | # -*- coding: utf-8 -*- |
| 2 | #------------------------------------------------------------------------------- |
| 3 | # Copyright (c) 2019-2022, Arm Limited. All rights reserved. |
| 4 | # |
| 5 | # SPDX-License-Identifier: BSD-3-Clause |
| 6 | # |
| 7 | #------------------------------------------------------------------------------- |
| 8 | |
| 9 | # Configuration file for the Sphinx documentation builder. |
| 10 | # |
| 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 | |
| 15 | import os |
| 16 | import sys |
| 17 | import re |
| 18 | from subprocess import check_output |
| 19 | |
| 20 | # -- Project information ----------------------------------------------------- |
| 21 | |
Elena Uziunaite | 12e0ae6 | 2023-11-07 16:57:07 +0000 | [diff] [blame] | 22 | project = 'Trusted Firmware-M Tools' |
Elena Uziunaite | bd4d7a9 | 2023-10-24 15:58:31 +0100 | [diff] [blame] | 23 | copyright = '2023, ARM CE-OSS' |
| 24 | author = 'ARM CE-OSS' |
| 25 | title = 'User Guide' |
| 26 | |
| 27 | # -- Extract current version ------------------------------------------------- |
| 28 | |
| 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,})?$') |
| 32 | |
| 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 | extensions = [ |
| 47 | 'sphinx.ext.imgmath', |
| 48 | 'm2r2', #Support markdown files. Needed for external code. |
| 49 | 'sphinx.ext.autosectionlabel', #Make sphinx generate a label for each section |
| 50 | 'sphinxcontrib.plantuml', #Add support for PlantUML drawings |
| 51 | 'sphinxcontrib.rsvgconverter', #Add support for SVG to PDF |
| 52 | 'sphinx_tabs.tabs', #Enable tab extension in Sphinx |
Elena Uziunaite | 12e0ae6 | 2023-11-07 16:57:07 +0000 | [diff] [blame] | 53 | 'sphinx.ext.intersphinx', #Enable Intersphinx |
Elena Uziunaite | bd4d7a9 | 2023-10-24 15:58:31 +0100 | [diff] [blame] | 54 | ] |
| 55 | |
Elena Uziunaite | 12e0ae6 | 2023-11-07 16:57:07 +0000 | [diff] [blame] | 56 | intersphinx_mapping = { |
| 57 | "TF-M-Tests": ("https://trustedfirmware-m.readthedocs.io/projects/tf-m-tests/en/latest/", None), |
| 58 | "TF-M": ("https://trustedfirmware-m.readthedocs.io/en/latest/", None), |
| 59 | "TF-M-Extras": ("https://trustedfirmware-m.readthedocs.io/projects/tf-m-extras/en/latest/", None), |
| 60 | } |
| 61 | |
| 62 | intersphinx_disabled_reftypes = ["*"] |
| 63 | |
Elena Uziunaite | a6f8cd0 | 2023-11-20 17:38:00 +0000 | [diff] [blame] | 64 | #PlantUML |
| 65 | if 'PLANTUML_JAR_PATH' in os.environ: |
| 66 | plantuml = 'java -jar ' + os.environ['PLANTUML_JAR_PATH'] |
| 67 | |
Elena Uziunaite | bd4d7a9 | 2023-10-24 15:58:31 +0100 | [diff] [blame] | 68 | # Make auto section labels generated be prefixed with file name. |
| 69 | autosectionlabel_prefix_document=True |
| 70 | # Add auto section label for level 2 headers only. |
| 71 | autosectionlabel_maxdepth=2 |
| 72 | |
| 73 | # Add any paths that contain templates here, relative to this directory. |
| 74 | templates_path = ['_templates'] |
| 75 | |
| 76 | # The suffix(es) of source filenames. |
| 77 | # You can specify multiple suffix as a list of string: |
| 78 | # |
| 79 | source_suffix = ['.rst', '.md'] |
| 80 | |
| 81 | # The master toctree document. |
| 82 | master_doc = 'index' |
| 83 | |
| 84 | # The language for content autogenerated by Sphinx. Refer to documentation |
| 85 | # for a list of supported languages. |
| 86 | # |
| 87 | # This is also used if you do content translation via gettext catalogs. |
| 88 | # Usually you set "language" from the command line for these cases. |
| 89 | language = None |
| 90 | |
| 91 | # List of patterns, relative to source directory, that match files and |
| 92 | # directories to ignore when looking for source files. |
| 93 | # This pattern also affects html_static_path and html_extra_path . |
| 94 | exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'readme.rst', |
| 95 | 'platform/cypress/psoc64/security/keys/readme.rst', |
| 96 | 'lib/ext/**'] |
| 97 | |
| 98 | # The name of the Pygments (syntax highlighting) style to use. |
| 99 | pygments_style = 'sphinx' |
| 100 | |
| 101 | # -- Options for HTML output ------------------------------------------------- |
| 102 | |
| 103 | html_theme = 'sphinx_rtd_theme' |
| 104 | |
| 105 | html_theme_options = { |
| 106 | 'collapse_navigation' : False, |
| 107 | 'prev_next_buttons_location' : None, # Hide Prev and Next buttons |
| 108 | 'display_version': True, # Show version under logo |
| 109 | 'sticky_navigation': True, |
| 110 | 'navigation_depth': 3, |
| 111 | } |
| 112 | |
| 113 | # Remove the "View page source" link from the top of docs pages |
| 114 | html_show_sourcelink = False |
| 115 | |
| 116 | # Add any paths that contain custom static files (such as style sheets) here, |
| 117 | # relative to configuration directory. They are copied after the builtin static |
| 118 | # files, so a file named "default.css" will overwrite the builtin "default.css". |
| 119 | html_static_path = ['_static'] |
| 120 | |
| 121 | # Set the documentation logo relative to configuration directory |
| 122 | html_logo = '_static/images/tf_logo_white.png' |
| 123 | |
| 124 | # Set the documentation favicon |
| 125 | html_favicon = '_static/images/favicon.ico' |
| 126 | |
| 127 | #Disable adding conf.py copyright notice to HTML output |
| 128 | html_show_copyright = False |
| 129 | |
| 130 | # Disable showing Sphinx footer message: |
| 131 | # "Built with Sphinx using a theme provided by Read the Docs. " |
| 132 | html_show_sphinx = False |
| 133 | |
| 134 | #Add custom css for HTML. Used to allow full page width rendering |
| 135 | def setup(app): |
| 136 | app.add_css_file('css/tfm_custom.css') |
| 137 | |
| 138 | # -- Options for HTMLHelp output --------------------------------------------- |
| 139 | |
| 140 | # Output file base name for HTML help builder. |
| 141 | htmlhelp_basename = 'TF-M doc' |
| 142 | |
| 143 | # Enable figures and tables auto numbering |
| 144 | numfig = True |
| 145 | numfig_secnum_depth = 0 |
| 146 | numfig_format = { |
| 147 | 'figure': 'Figure %s:', |
| 148 | 'table': 'Table %s:', |
| 149 | 'code-block': 'Listing %s:', |
| 150 | 'section': '%s' |
| 151 | } |
| 152 | |
| 153 | # -- Options for LaTeX output ------------------------------------------------ |
| 154 | |
| 155 | latex_elements = { |
| 156 | # 'papersize': 'letterpaper', |
| 157 | # 'pointsize': '10pt', |
| 158 | # 'preamble': '', |
| 159 | # 'figure_align': 'htbp', |
| 160 | } |
| 161 | |
| 162 | # Grouping the document tree into LaTeX files. List of tuples |
| 163 | # (source start file, target name, title, |
| 164 | # author, documentclass [howto, manual, or own class]). |
| 165 | latex_documents = [ |
| 166 | (master_doc, 'TF-M.tex', title, |
| 167 | author, 'manual'), |
| 168 | ] |
| 169 | |
| 170 | language = 'en' |