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