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'(?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', 'sphinxcontrib.plantuml']
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# The language for content autogenerated by Sphinx. Refer to documentation
49# for a list of supported languages.
50#
51# This is also used if you do content translation via gettext catalogs.
52# Usually you set "language" from the command line for these cases.
53language = None
54
55# List of patterns, relative to source directory, that match files and
56# directories to ignore when looking for source files.
57# This pattern also affects html_static_path and html_extra_path .
58exclude_patterns = []
59
60# The name of the Pygments (syntax highlighting) style to use.
61pygments_style = 'sphinx'
62
63# Load the contents of the global substitutions file into the 'rst_prolog'
64# variable. This ensures that the substitutions are all inserted into each page.
65with open('global_substitutions.txt', 'r') as subs:
66  rst_prolog = subs.read()
67
68# Minimum version of sphinx required
69needs_sphinx = '2.4'
70
71# -- Options for HTML output -------------------------------------------------
72
73# Don't show the "Built with Sphinx" footer
74html_show_sphinx = False
75
76# Show copyright info in the footer
77html_show_copyright = True
78
79# The theme to use for HTML and HTML Help pages.  See the documentation for
80# a list of builtin themes.
81html_theme = "sphinx_rtd_theme"
82
83# The logo to display in the sidebar
84html_logo = '_static/images/TrustedFirmware-Logo_standard-white.png'
85
86# Options for the "sphinx-rtd-theme" theme
87html_theme_options = {
88    'collapse_navigation': False, # Can expand and collapse sidebar entries
89    'prev_next_buttons_location': 'both', # Top and bottom of the page
90    'style_external_links': True # Display an icon next to external links
91}
92
93# Path to _static directory
94html_static_path = ['_static']
95
96# Path to css file relative to html_static_path
97html_css_files = ['css/rmm_custom.css',]
98
99# -- Options for autosectionlabel --------------------------------------------
100
101# Only generate automatic section labels for document titles
102autosectionlabel_maxdepth = 1
103
104# -- Options for plantuml ----------------------------------------------------
105
106plantuml_output_format = 'svg_img'
107