xref: /libCEED/doc/sphinx/source/conf.py (revision ccaff0309dc399f656ea11018b919b30feb8b0fa)
1#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
3#
4# libCEED documentation build configuration file, created by
5# sphinx-quickstart on Tue Jan  7 18:59:28 2020.
6#
7# This file is execfile()d with the current directory set to its
8# containing dir.
9#
10# Note that not all possible configuration values are present in this
11# autogenerated file.
12#
13# All configuration values have a default; values that are commented out
14# serve to show the default.
15
16# If extensions (or modules to document with autodoc) are in another directory,
17# add these directories to sys.path here. If the directory is relative to the
18# documentation root, use os.path.abspath to make it absolute, like shown here.
19#
20# import os
21# import sys
22# sys.path.insert(0, os.path.abspath('.'))
23import sphinx_rtd_theme
24import sys
25import breathe
26import os
27import subprocess
28
29# -- General configuration ------------------------------------------------
30
31# If your documentation needs a minimal Sphinx version, state it here.
32#
33# needs_sphinx = '1.0'
34
35# Add any Sphinx extension module names here, as strings. They can be
36# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
37# ones.
38extensions = [
39    'breathe',
40    'hoverxref.extension',  # still in beta; not rendering well on RTD
41    'recommonmark',
42    'sphinx_markdown_tables',
43    'sphinx_rtd_theme',
44    'sphinx.ext.autodoc',
45    'sphinx.ext.coverage',
46    'sphinx.ext.doctest',
47    'sphinx.ext.ifconfig',
48    'sphinx.ext.intersphinx',
49    'sphinx.ext.githubpages',
50    'sphinxcontrib.katex',
51    'sphinxcontrib.mermaid',  # still in beta; fails with latexpdf builder
52    'sphinx.ext.todo',
53    'sphinx.ext.viewcode',
54    'sphinxcontrib.bibtex',
55    'sphinxcontrib.rsvgconverter',
56    ]
57
58# The following, if true, allows figures, tables and code-blocks to be
59# automatically numbered if they have a caption.
60numfig = True
61
62# Add any paths that contain templates here, relative to this directory.
63templates_path = ['_templates']
64
65# The suffix(es) of source filenames.
66# You can specify multiple suffix as a list of string:
67#
68# source_suffix = ['.rst', '.md']
69source_suffix = {
70    '.rst': 'restructuredtext',
71    '.md': 'markdown'}
72
73# The master toctree document.
74master_doc = 'index'
75
76# General information about the project.
77project = 'libCEED'
78copyright = '2020, LLNL, University of Colorado, University of Illinois, University of Tennesee, and the authors'
79with open('../../../AUTHORS') as f:
80    authorlist = f.readlines()
81author = ', '.join(authorlist)
82
83# The version info for the project you're documenting, acts as replacement for
84# |version| and |release|, also used in various other places throughout the
85# built documents.
86#
87# The short X.Y version.
88with open('../../../ceed.pc.template') as f:
89    pkgconf_version = 'unknown'
90    for line in f:
91        if line.startswith('Version:'):
92            pkgconf_version = line.partition(': ')[2]
93            break
94version = pkgconf_version
95# The full version, including alpha/beta/rc tags.
96release = pkgconf_version
97
98# The language for content autogenerated by Sphinx. Refer to documentation
99# for a list of supported languages.
100#
101# This is also used if you do content translation via gettext catalogs.
102# Usually you set "language" from the command line for these cases.
103language = None
104
105# List of patterns, relative to source directory, that match files and
106# directories to ignore when looking for source files.
107# This patterns also effect to html_static_path and html_extra_path
108exclude_patterns = []
109
110# The name of the Pygments (syntax highlighting) style to use.
111pygments_style = 'sphinx'
112
113# If true, `todo` and `todoList` produce output, else they produce nothing.
114todo_include_todos = True
115
116
117# -- Options for HTML output ----------------------------------------------
118
119# The theme to use for HTML and HTML Help pages.  See the documentation for
120# a list of builtin themes.
121#
122html_theme = 'sphinx_rtd_theme'
123
124# Theme options are theme-specific and customize the look and feel of a theme
125# further.  For a list of options available for each theme, see the
126# documentation.
127#
128# html_theme_options = {}
129
130# Add any paths that contain custom static files (such as style sheets) here,
131# relative to this directory. They are copied after the builtin static files,
132# so a file named "default.css" will overwrite the builtin "default.css".
133html_static_path = ['_static']
134
135# Custom sidebar templates, must be a dictionary that maps document names
136# to template names.
137#
138# This is required for the alabaster theme
139# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
140html_sidebars = {
141    '**': [
142        'relations.html',  # needs 'show_related': True theme option to display
143        'searchbox.html',
144    ]
145}
146
147# hoverxref options
148hoverxref_auto_ref = True
149hoverxref_mathjax = True
150
151katex_options = r'''{
152    macros: {
153        '\\diff': '{\\operatorname{d}}',
154    },
155}'''
156
157# -- Options for HTMLHelp output ------------------------------------------
158
159# Output file base name for HTML help builder.
160htmlhelp_basename = 'libCEEDdoc'
161
162
163# -- Options for LaTeX output ---------------------------------------------
164
165latex_engine = 'xelatex'
166
167latex_elements = {
168    # The paper size ('letterpaper' or 'a4paper').
169    #
170    # 'papersize': 'letterpaper',
171
172    # The font size ('10pt', '11pt' or '12pt').
173    #
174    # 'pointsize': '10pt',
175
176    # Additional stuff for the LaTeX preamble.
177    #
178    'preamble': r'''
179\usepackage{bm}
180\newcommand{\diff}{\operatorname{d}}
181''',
182
183    # Latex figure (float) alignment
184    #
185    # 'figure_align': 'htbp',
186    'fontenc': r'\usepackage{mathspec}',
187    'fontpkg': r'''
188\setmainfont{TeX Gyre Pagella}
189\setmathfont{TeX Gyre Pagella Math}
190\setsansfont{DejaVu Sans}
191\setmonofont{DejaVu Sans Mono}
192''',
193}
194
195latex_logo = '../../img/ceed-full-name-logo.PNG'
196
197latexauthorslist = r' \and '.join(authorlist)
198
199# Grouping the document tree into LaTeX files. List of tuples
200# (source start file, target name, title,
201#  author, documentclass [howto, manual, or own class]).
202latex_documents = [
203    (master_doc, 'libCEED.tex', 'libCEED User Manual',
204     latexauthorslist, 'howto'),
205]
206
207
208# -- Options for manual page output ---------------------------------------
209
210# One entry per manual page. List of tuples
211# (source start file, name, description, authors, manual section).
212man_pages = [
213    (master_doc, 'libceed', 'libCEED User Manual',
214     [author], 1)
215]
216
217
218# -- Options for Texinfo output -------------------------------------------
219
220# Grouping the document tree into Texinfo files. List of tuples
221# (source start file, target name, title, author,
222#  dir menu entry, description, category)
223texinfo_documents = [
224    (master_doc, 'libCEED', 'libCEED User Manual',
225     latexauthorslist, 'libCEED', 'Efficient implementations of finite element operators.',
226     'Miscellaneous'),
227]
228
229
230# -- Options for Epub output ----------------------------------------------
231
232# Bibliographic Dublin Core info.
233epub_title = project
234epub_author = author
235epub_publisher = author
236epub_copyright = copyright
237
238# The unique identifier of the text. This can be a ISBN number
239# or the project homepage.
240#
241# epub_identifier = ''
242
243# A unique identification for the text.
244#
245# epub_uid = ''
246
247# A list of files that should not be packed into the epub file.
248epub_exclude_files = ['search.html']
249
250
251# Example configuration for intersphinx: refer to the Python standard library.
252intersphinx_mapping = {'https://docs.python.org/': None}
253
254
255# -- Options for breathe --------------------------------------------------
256sys.path.append(breathe.__path__)
257breathe_projects = {"libCEED": "../../../xml"}
258breathe_default_project = "libCEED"
259breathe_build_directory = "../build/breathe"
260#breathe_domain_by_extension = {"c": "c", "h": "c", "cpp": "cpp", "hpp": "cpp"}
261
262# Run Doxygen if building on Read The Docs
263rootdir = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, os.pardir)
264if os.environ.get('READTHEDOCS'):
265    subprocess.check_call(['doxygen', 'Doxyfile'], cwd=rootdir)
266
267# Copy example documentation from source tree
268def mkdir_p(path):
269    try:
270        os.makedirs(path)
271    except FileExistsError:
272        pass
273
274import glob
275import shutil
276try:
277    shutil.rmtree('examples')
278except FileNotFoundError:
279    pass
280for filename in glob.glob(os.path.join(rootdir, 'examples/**/*.rst'), recursive=True):
281    destdir = os.path.dirname(os.path.relpath(filename, rootdir))
282    mkdir_p(destdir)
283    shutil.copy2(filename, destdir)
284