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