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 'altair.sphinxext.altairplot', 42 'breathe', 43 'hoverxref.extension', 44 'sphinx_panels', 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 = None 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] 111 112# The name of the Pygments (syntax highlighting) style to use. 113pygments_style = 'sphinx' 114 115# If true, `todo` and `todoList` produce output, else they produce nothing. 116todo_include_todos = True 117 118# sphinxcontrib-bibtex 2.0 requires listing all bibtex files here 119bibtex_bibfiles = [ 120 'references.bib', 121] 122 123myst_enable_extensions = [ 124 'deflist', 125 'dollarmath', 126 'html_image', 127 'linkify', 128 'colon_fence', 129] 130 131myst_heading_anchors = 2 132myst_url_schemes = ["http", "https", "mailto"] 133 134# -- Options for HTML output ---------------------------------------------- 135 136# The theme to use for HTML and HTML Help pages. See the documentation for 137# a list of builtin themes. 138# 139html_theme = 'sphinx_rtd_theme' 140 141# Theme options are theme-specific and customize the look and feel of a theme 142# further. For a list of options available for each theme, see the 143# documentation. 144# 145# html_theme_options = {} 146 147# Add any paths that contain custom static files (such as style sheets) here, 148# relative to this directory. They are copied after the builtin static files, 149# so a file named "default.css" will overwrite the builtin "default.css". 150html_static_path = ["css"] 151 152# Custom sidebar templates, must be a dictionary that maps document names 153# to template names. 154# 155# This is required for the alabaster theme 156# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars 157html_sidebars = { 158 '**': [ 159 'relations.html', # needs 'show_related': True theme option to display 160 'searchbox.html', 161 ] 162} 163 164# hoverxref options 165hoverxref_auto_ref = True 166hoverxref_mathjax = True 167 168latex_macros = r""" 169\def \diff {\operatorname{d}\!} 170\def \tcolon {\!:\!} 171\def \trace {\operatorname{trace}} 172""" 173 174# Translate LaTeX macros to KaTeX and add to options for HTML builder 175katex_macros = katex.latex_defs_to_katex_macros(latex_macros) 176katex_options = 'macros: {' + katex_macros + '}' 177 178 179def katex_cdn(path): 180 katex_gitcommit = '7c696bb7ac8995f177676d62be09ceefa37d66e3' 181 return f'https://cdn.jsdelivr.net/gh/jedbrown/katex@{katex_gitcommit}/' + path 182 183 184katex_css_path = katex_cdn('dist/katex.min.css') 185katex_js_path = katex_cdn('dist/katex.min.js') 186katex_autorender_path = katex_cdn('dist/contrib/auto-render.min.js') 187 188# -- Options for HTMLHelp output ------------------------------------------ 189 190# Output file base name for HTML help builder. 191htmlhelp_basename = 'libCEEDdoc' 192 193 194# -- Options for LaTeX output --------------------------------------------- 195 196latex_engine = 'xelatex' 197 198latex_elements = { 199 # The paper size ('letterpaper' or 'a4paper'). 200 # 201 # 'papersize': 'letterpaper', 202 203 # The font size ('10pt', '11pt' or '12pt'). 204 # 205 # 'pointsize': '10pt', 206 207 # Additional stuff for the LaTeX preamble. 208 # 209 'preamble': r""" 210\usepackage{bm} 211\usepackage{amscd} 212""" + latex_macros, 213 214 # Latex figure (float) alignment 215 # 216 # 'figure_align': 'htbp', 217 'fontenc': r'\usepackage{mathspec}', 218 'fontpkg': r""" 219\setmainfont{TeX Gyre Pagella} 220\setmathfont{TeX Gyre Pagella Math} 221\setsansfont{DejaVu Sans} 222\setmonofont{DejaVu Sans Mono} 223""", 224} 225 226latex_logo = '../../img/ceed-full-name-logo.PNG' 227 228latexauthorslist = r' \and '.join(authorlist) 229 230# Grouping the document tree into LaTeX files. List of tuples 231# (source start file, target name, title, 232# author, documentclass [howto, manual, or own class]). 233latex_documents = [ 234 (master_doc, 'libCEED.tex', 'libCEED User Manual', 235 latexauthorslist, 'howto'), 236] 237 238 239# -- Options for manual page output --------------------------------------- 240 241# One entry per manual page. List of tuples 242# (source start file, name, description, authors, manual section). 243man_pages = [ 244 (master_doc, 'libceed', 'libCEED User Manual', 245 [author], 1) 246] 247 248 249# -- Options for Texinfo output ------------------------------------------- 250 251# Grouping the document tree into Texinfo files. List of tuples 252# (source start file, target name, title, author, 253# dir menu entry, description, category) 254texinfo_documents = [ 255 (master_doc, 'libCEED', 'libCEED User Manual', 256 latexauthorslist, 'libCEED', 'Efficient implementations of finite element operators.', 257 'Miscellaneous'), 258] 259 260 261# -- Options for Epub output ---------------------------------------------- 262 263# Bibliographic Dublin Core info. 264epub_title = project 265epub_author = author 266epub_publisher = author 267epub_copyright = copyright 268 269# The unique identifier of the text. This can be a ISBN number 270# or the project homepage. 271# 272# epub_identifier = '' 273 274# A unique identification for the text. 275# 276# epub_uid = '' 277 278# A list of files that should not be packed into the epub file. 279epub_exclude_files = ['search.html'] 280 281 282# Example configuration for intersphinx: refer to the Python standard library. 283intersphinx_mapping = { 284 'python': ('https://docs.python.org/3', None), 285 'numpy': ('https://numpy.org/devdocs', None), 286} 287 288 289# -- Options for breathe -------------------------------------------------- 290sys.path.append(breathe.__path__) 291breathe_projects = {"libCEED": "../../../xml"} 292breathe_default_project = "libCEED" 293breathe_build_directory = "../build/breathe" 294breathe_domain_by_extension = {"c": "c", "h": "c", "cpp": "cpp", "hpp": "cpp"} 295 296# Run Doxygen if building on Read The Docs 297rootdir = os.path.join(os.path.dirname(__file__), 298 os.pardir, os.pardir, os.pardir) 299if os.environ.get('READTHEDOCS'): 300 subprocess.check_call(['doxygen', 'Doxyfile'], cwd=rootdir) 301 302 303def mkdir_p(path): 304 try: 305 os.makedirs(path) 306 except FileExistsError: 307 pass 308 309 310# Copy example documentation from source tree 311try: 312 shutil.rmtree('examples') 313except FileNotFoundError: 314 pass 315for filename in glob.glob(os.path.join( 316 rootdir, 'examples/**/*.md'), recursive=True): 317 destdir = os.path.dirname(os.path.relpath(filename, rootdir)) 318 mkdir_p(destdir) 319 shutil.copy2(filename, destdir) 320shutil.copy2(os.path.join(rootdir, 'README.md'), '.') 321 322for filename in glob.glob(os.path.join( 323 rootdir, 'examples/**/*.csv'), recursive=True): 324 destdir = os.path.dirname(os.path.relpath(filename, rootdir)) 325 mkdir_p(destdir) 326 shutil.copy2(filename, destdir) 327