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