1# -*- coding: utf-8 -*-
2# SPDX-License-Identifier: BSD-3-Clause
3# SPDX-FileCopyrightText: Copyright TF-RMM Contributors.
4#
5# Configuration file for the Sphinx documentation builder.
6#
7# See the options documentation at http://www.sphinx-doc.org/en/master/config
8
9import os
10import re
11from subprocess import check_output
12
13# -- Project information -----------------------------------------------------
14
15project = 'Realm Management Monitor'
16copyright = 'TF-RMM Contributors'
17author = 'TF-RMM Contributors'
18title = 'User Guide'
19
20try:
21  vregx = re.compile(r'tf-rmm-(?P<RMM_VERSION>v.+?)'
22                     r'(-[0-9]+-)?(?P<GIT_SHA>g[a-f0-9]{7,})?$')
23  git_result = check_output("git describe --tags --always",
24                            shell = True, encoding = 'UTF-8')
25  _v = vregx.match(git_result)
26  version = _v.group('RMM_VERSION')
27  if _v.group('GIT_SHA'):
28    version += "+" + _v.group('GIT_SHA')[:7]
29except:
30  version = 'Unknown'
31
32# -- General configuration ---------------------------------------------------
33
34# Add any Sphinx extension module names here, as strings. They can be
35# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
36# ones.
37extensions = ['sphinx.ext.autosectionlabel']
38
39# Add any paths that contain templates here, relative to this directory.
40templates_path = ['_templates']
41
42# The suffix(es) of source filenames.
43source_suffix = ['.rst']
44
45# The master toctree document.
46master_doc = 'index'
47
48# List of patterns, relative to source directory, that match files and
49# directories to ignore when looking for source files.
50# This pattern also affects html_static_path and html_extra_path .
51exclude_patterns = []
52
53# The name of the Pygments (syntax highlighting) style to use.
54pygments_style = 'sphinx'
55
56# Load the contents of the global substitutions file into the 'rst_prolog'
57# variable. This ensures that the substitutions are all inserted into each page.
58with open('global_substitutions.txt', 'r') as subs:
59  rst_prolog = subs.read()
60
61# Minimum version of sphinx required
62needs_sphinx = '5.3.0'
63
64# -- Options for HTML output -------------------------------------------------
65
66# Don't show the "Built with Sphinx" footer
67html_show_sphinx = False
68
69# Show copyright info in the footer
70html_show_copyright = True
71
72# The theme to use for HTML and HTML Help pages.  See the documentation for
73# a list of builtin themes.
74html_theme = "sphinx_rtd_theme"
75
76# The logo to display in the sidebar
77html_logo = '_static/images/TrustedFirmware-Logo_standard-white.png'
78
79# Options for the "sphinx-rtd-theme" theme
80html_theme_options = {
81    'collapse_navigation': False, # Can expand and collapse sidebar entries
82    'prev_next_buttons_location': 'both', # Top and bottom of the page
83    'style_external_links': True # Display an icon next to external links
84}
85
86# Path to _static directory
87html_static_path = ['_static']
88
89# Path to css file relative to html_static_path
90html_css_files = ['css/rmm_custom.css',]
91
92# -- Options for autosectionlabel --------------------------------------------
93
94# Only generate automatic section labels for document titles
95autosectionlabel_maxdepth = 1
96
97# -- Options for plantuml ----------------------------------------------------
98
99plantuml_output_format = 'svg_img'
100