blob: ccbe37aa9bea3129f94a39201ea2189231572411 [file] [log] [blame]
Elena Uziunaitebd4d7a92023-10-24 15:58:31 +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
16import sys
17import re
18from subprocess import check_output
19
20# -- Project information -----------------------------------------------------
21
22project = 'Trusted Firmware-M Tests'
23copyright = '2023, ARM CE-OSS'
24author = 'ARM CE-OSS'
25title = 'User Guide'
26
27# -- Extract current version -------------------------------------------------
28
29try:
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
41except:
42 version = release = 'Unknown'
43
44# -- General configuration ---------------------------------------------------
45
46extensions = [
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
53]
54
55# Make auto section labels generated be prefixed with file name.
56autosectionlabel_prefix_document=True
57# Add auto section label for level 2 headers only.
58autosectionlabel_maxdepth=2
59
60# Add any paths that contain templates here, relative to this directory.
61templates_path = ['_templates']
62
63# The suffix(es) of source filenames.
64# You can specify multiple suffix as a list of string:
65#
66source_suffix = ['.rst', '.md']
67
68# The master toctree document.
69master_doc = 'index'
70
71# The language for content autogenerated by Sphinx. Refer to documentation
72# for a list of supported languages.
73#
74# This is also used if you do content translation via gettext catalogs.
75# Usually you set "language" from the command line for these cases.
76language = None
77
78# List of patterns, relative to source directory, that match files and
79# directories to ignore when looking for source files.
80# This pattern also affects html_static_path and html_extra_path .
81exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'readme.rst',
82 'platform/cypress/psoc64/security/keys/readme.rst',
83 'lib/ext/**']
84
85# The name of the Pygments (syntax highlighting) style to use.
86pygments_style = 'sphinx'
87
88# -- Options for HTML output -------------------------------------------------
89
90html_theme = 'sphinx_rtd_theme'
91
92html_theme_options = {
93 'collapse_navigation' : False,
94 'prev_next_buttons_location' : None, # Hide Prev and Next buttons
95 'display_version': True, # Show version under logo
96 'sticky_navigation': True,
97 'navigation_depth': 3,
98}
99
100# Remove the "View page source" link from the top of docs pages
101html_show_sourcelink = False
102
103# Add any paths that contain custom static files (such as style sheets) here,
104# relative to configuration directory. They are copied after the builtin static
105# files, so a file named "default.css" will overwrite the builtin "default.css".
106html_static_path = ['_static']
107
108# Set the documentation logo relative to configuration directory
109html_logo = '_static/images/tf_logo_white.png'
110
111# Set the documentation favicon
112html_favicon = '_static/images/favicon.ico'
113
114#Disable adding conf.py copyright notice to HTML output
115html_show_copyright = False
116
117# Disable showing Sphinx footer message:
118# "Built with Sphinx using a theme provided by Read the Docs. "
119html_show_sphinx = False
120
121#Add custom css for HTML. Used to allow full page width rendering
122def setup(app):
123 app.add_css_file('css/tfm_custom.css')
124
125# -- Options for HTMLHelp output ---------------------------------------------
126
127# Output file base name for HTML help builder.
128htmlhelp_basename = 'TF-M doc'
129
130# Enable figures and tables auto numbering
131numfig = True
132numfig_secnum_depth = 0
133numfig_format = {
134 'figure': 'Figure %s:',
135 'table': 'Table %s:',
136 'code-block': 'Listing %s:',
137 'section': '%s'
138}
139
140# -- Options for LaTeX output ------------------------------------------------
141
142latex_elements = {
143 # 'papersize': 'letterpaper',
144 # 'pointsize': '10pt',
145 # 'preamble': '',
146 # 'figure_align': 'htbp',
147}
148
149# Grouping the document tree into LaTeX files. List of tuples
150# (source start file, target name, title,
151# author, documentclass [howto, manual, or own class]).
152latex_documents = [
153 (master_doc, 'TF-M.tex', title,
154 author, 'manual'),
155]
156
157language = 'en'