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