blob: 16da202f63dc7492f5ffc6a90d13eb3d99b4ca1c [file] [log] [blame]
Anton Komlevb813dbc2022-04-01 21:12:16 +01001# -*- coding: utf-8 -*-
2#-------------------------------------------------------------------------------
3# Copyright (c) 2019-2022, Arm Limited. All rights reserved.
Minos Galanakisd19a19f2020-06-03 15:38:03 +01004#
5# SPDX-License-Identifier: BSD-3-Clause
6#
Anton Komlevb813dbc2022-04-01 21:12:16 +01007#-------------------------------------------------------------------------------
8
9# Configuration file for the Sphinx documentation builder.
Minos Galanakisd19a19f2020-06-03 15:38:03 +010010#
Anton Komlevb813dbc2022-04-01 21:12:16 +010011# 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 Galanakisd19a19f2020-06-03 15:38:03 +010015import os
16import sys
Anton Komlevb813dbc2022-04-01 21:12:16 +010017import re
18from subprocess import check_output
Minos Galanakisd19a19f2020-06-03 15:38:03 +010019
Anton Komlevb813dbc2022-04-01 21:12:16 +010020# -- Project information -----------------------------------------------------
Minos Galanakisd19a19f2020-06-03 15:38:03 +010021
Anton Komlevb813dbc2022-04-01 21:12:16 +010022project = 'Trusted Firmware-M'
23copyright = '2017-2022, ARM CE-OSS'
24author = 'ARM CE-OSS'
25title = 'User Guide'
Minos Galanakisd19a19f2020-06-03 15:38:03 +010026
Anton Komlevb813dbc2022-04-01 21:12:16 +010027# -- Extract current version -------------------------------------------------
Minos Galanakisd19a19f2020-06-03 15:38:03 +010028
Anton Komlevb813dbc2022-04-01 21:12:16 +010029try:
30 vrex = re.compile(r'TF-M(?P<GIT_VERSION>v.+?)'
31 r'(-[0-9]+-g)?(?P<GIT_SHA>[a-f0-9]{7,})?$')
Minos Galanakisd19a19f2020-06-03 15:38:03 +010032
Anton Komlevb813dbc2022-04-01 21:12:16 +010033 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
41except:
42 version = release = 'Unknown'
43
44# -- General configuration ---------------------------------------------------
45
Anton Komlevb813dbc2022-04-01 21:12:16 +010046extensions = [
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
Antonio de Angelis671c9712023-02-15 22:40:32 +000052 'sphinx_tabs.tabs', #Enable tab extension in Sphinx
Elena Uziunaiteafcd4612023-11-07 16:49:48 +000053 'sphinx.ext.intersphinx', #Enable Intersphinx
Anton Komlevb813dbc2022-04-01 21:12:16 +010054]
55
Elena Uziunaiteafcd4612023-11-07 16:49:48 +000056intersphinx_mapping = {
57 "TF-M-Tests": ("https://trustedfirmware-m.readthedocs.io/projects/tf-m-tests/en/latest/", None),
58 "TF-M-Tools": ("https://trustedfirmware-m.readthedocs.io/projects/tf-m-tools/en/latest/", None),
59 "TF-M-Extras": ("https://trustedfirmware-m.readthedocs.io/projects/tf-m-extras/en/latest/", None),
60}
61
62intersphinx_disabled_reftypes = ["*"]
63
Anton Komlev6f1e5492022-06-16 19:08:57 +010064# Make auto section labels generated be prefixed with file name.
Anton Komlevb813dbc2022-04-01 21:12:16 +010065autosectionlabel_prefix_document=True
Anton Komlev6f1e5492022-06-16 19:08:57 +010066# Add auto section label for level 2 headers only.
Anton Komlevb813dbc2022-04-01 21:12:16 +010067autosectionlabel_maxdepth=2
68
69# Add any paths that contain templates here, relative to this directory.
70templates_path = ['_templates']
71
72# The suffix(es) of source filenames.
73# You can specify multiple suffix as a list of string:
74#
75source_suffix = ['.rst', '.md']
76
77# The master toctree document.
78master_doc = 'index'
79
80# The language for content autogenerated by Sphinx. Refer to documentation
81# for a list of supported languages.
82#
83# This is also used if you do content translation via gettext catalogs.
84# Usually you set "language" from the command line for these cases.
85language = None
86
87# List of patterns, relative to source directory, that match files and
88# directories to ignore when looking for source files.
89# This pattern also affects html_static_path and html_extra_path .
90exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'readme.rst',
Anton Komlevde14f452022-06-19 15:45:26 +010091 'platform/cypress/psoc64/security/keys/readme.rst',
Anton Komlevb813dbc2022-04-01 21:12:16 +010092 'lib/ext/**']
93
94# The name of the Pygments (syntax highlighting) style to use.
95pygments_style = 'sphinx'
96
97# -- Options for HTML output -------------------------------------------------
98
Anton Komlevb813dbc2022-04-01 21:12:16 +010099html_theme = 'sphinx_rtd_theme'
100
Anton Komlev8e448342022-04-06 10:19:35 +0100101html_theme_options = {
Anton Komlev91281f02022-04-22 09:24:20 +0100102 'collapse_navigation' : False,
103 'prev_next_buttons_location' : None, # Hide Prev and Next buttons
Anton Komlev6f1e5492022-06-16 19:08:57 +0100104 'display_version': True, # Show version under logo
Anton Komlev91281f02022-04-22 09:24:20 +0100105 'sticky_navigation': True,
Anton Komlev1f1bec02022-06-17 15:45:09 +0100106 'navigation_depth': 3,
Anton Komlev8e448342022-04-06 10:19:35 +0100107}
108
109# Remove the "View page source" link from the top of docs pages
110html_show_sourcelink = False
111
Anton Komlevb813dbc2022-04-01 21:12:16 +0100112# Add any paths that contain custom static files (such as style sheets) here,
113# relative to configuration directory. They are copied after the builtin static
114# files, so a file named "default.css" will overwrite the builtin "default.css".
115html_static_path = ['_static']
116
117# Set the documentation logo relative to configuration directory
118html_logo = '_static/images/tf_logo_white.png'
119
Anton Komlev8e448342022-04-06 10:19:35 +0100120# Set the documentation favicon
121html_favicon = '_static/images/favicon.ico'
122
Anton Komlevb813dbc2022-04-01 21:12:16 +0100123#Disable adding conf.py copyright notice to HTML output
124html_show_copyright = False
125
Anton Komlev8e448342022-04-06 10:19:35 +0100126# Disable showing Sphinx footer message:
127# "Built with Sphinx using a theme provided by Read the Docs. "
128html_show_sphinx = False
129
Anton Komlevb813dbc2022-04-01 21:12:16 +0100130#Add custom css for HTML. Used to allow full page width rendering
131def setup(app):
132 app.add_css_file('css/tfm_custom.css')
133
134# -- Options for HTMLHelp output ---------------------------------------------
135
136# Output file base name for HTML help builder.
137htmlhelp_basename = 'TF-M doc'
138
Anton Komlevb813dbc2022-04-01 21:12:16 +0100139# Enable figures and tables auto numbering
140numfig = True
141numfig_secnum_depth = 0
142numfig_format = {
143 'figure': 'Figure %s:',
144 'table': 'Table %s:',
145 'code-block': 'Listing %s:',
146 'section': '%s'
147}
148
149# -- Options for LaTeX output ------------------------------------------------
150
151latex_elements = {
Anton Komlevb813dbc2022-04-01 21:12:16 +0100152 # 'papersize': 'letterpaper',
Anton Komlevb813dbc2022-04-01 21:12:16 +0100153 # 'pointsize': '10pt',
Anton Komlevb813dbc2022-04-01 21:12:16 +0100154 # 'preamble': '',
Anton Komlevb813dbc2022-04-01 21:12:16 +0100155 # 'figure_align': 'htbp',
156}
157
158# Grouping the document tree into LaTeX files. List of tuples
159# (source start file, target name, title,
160# author, documentclass [howto, manual, or own class]).
161latex_documents = [
162 (master_doc, 'TF-M.tex', title,
163 author, 'manual'),
164]
165
Antonio de Angelis671c9712023-02-15 22:40:32 +0000166language = 'en'