1# -*- coding: utf-8 -*- 2# 3# LLVM documentation build configuration file. 4# 5# This file is execfile()d with the current directory set to its containing dir. 6# 7# Note that not all possible configuration values are present in this 8# autogenerated file. 9# 10# All configuration values have a default; values that are commented out 11# serve to show the default. 12from __future__ import print_function 13 14import sys, os, re 15from datetime import date 16 17# If extensions (or modules to document with autodoc) are in another directory, 18# add these directories to sys.path here. If the directory is relative to the 19# documentation root, use os.path.abspath to make it absolute, like shown here. 20#sys.path.insert(0, os.path.abspath('.')) 21 22# -- General configuration ----------------------------------------------------- 23 24# If your documentation needs a minimal Sphinx version, state it here. 25#needs_sphinx = '1.0' 26 27# Add any Sphinx extension module names here, as strings. They can be extensions 28# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. 29extensions = ['sphinx.ext.intersphinx', 'sphinx.ext.todo'] 30 31# Add any paths that contain templates here, relative to this directory. 32templates_path = ['_templates'] 33 34# The suffix of source filenames. 35source_suffix = { 36 '.rst': 'restructuredtext', 37} 38 39try: 40 import recommonmark 41except ImportError: 42 # manpages do not use any .md sources 43 if not tags.has('builder-man'): 44 raise 45else: 46 import sphinx 47 if sphinx.version_info >= (3, 0): 48 # This requires 0.5 or later. 49 extensions.append('recommonmark') 50 else: 51 source_parsers = {'.md': 'recommonmark.parser.CommonMarkParser'} 52 source_suffix['.md'] = 'markdown' 53 54# The encoding of source files. 55#source_encoding = 'utf-8-sig' 56 57# The master toctree document. 58master_doc = 'index' 59 60# General information about the project. 61project = u'LLVM' 62copyright = u'2003-%d, LLVM Project' % date.today().year 63 64# The language for content autogenerated by Sphinx. Refer to documentation 65# for a list of supported languages. 66#language = None 67 68# There are two options for replacing |today|: either, you set today to some 69# non-false value, then it is used: 70#today = '' 71# Else, today_fmt is used as the format for a strftime call. 72today_fmt = '%Y-%m-%d' 73 74# List of patterns, relative to source directory, that match files and 75# directories to ignore when looking for source files. 76exclude_patterns = ['_build'] 77 78# The reST default role (used for this markup: `text`) to use for all documents. 79#default_role = None 80 81# If true, '()' will be appended to :func: etc. cross-reference text. 82#add_function_parentheses = True 83 84# If true, the current module name will be prepended to all description 85# unit titles (such as .. function::). 86#add_module_names = True 87 88# If true, sectionauthor and moduleauthor directives will be shown in the 89# output. They are ignored by default. 90show_authors = True 91 92# The name of the Pygments (syntax highlighting) style to use. 93pygments_style = 'friendly' 94 95# A list of ignored prefixes for module index sorting. 96#modindex_common_prefix = [] 97 98 99# -- Options for HTML output --------------------------------------------------- 100 101# The theme to use for HTML and HTML Help pages. See the documentation for 102# a list of builtin themes. 103html_theme = 'llvm-theme' 104 105# Theme options are theme-specific and customize the look and feel of a theme 106# further. For a list of options available for each theme, see the 107# documentation. 108html_theme_options = { "nosidebar": False } 109 110# Add any paths that contain custom themes here, relative to this directory. 111html_theme_path = ["_themes"] 112 113# The name for this set of Sphinx documents. If None, it defaults to 114# "<project> v<release> documentation". 115#html_title = None 116 117# A shorter title for the navigation bar. Default is the same as html_title. 118#html_short_title = None 119 120# The name of an image file (relative to this directory) to place at the top 121# of the sidebar. 122#html_logo = None 123 124# The name of an image file (within the static path) to use as favicon of the 125# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 126# pixels large. 127#html_favicon = None 128 129# Add any paths that contain custom static files (such as style sheets) here, 130# relative to this directory. They are copied after the builtin static files, 131# so a file named "default.css" will overwrite the builtin "default.css". 132html_static_path = ['_static'] 133 134# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, 135# using the given strftime format. 136html_last_updated_fmt = '%Y-%m-%d' 137 138# If true, SmartyPants will be used to convert quotes and dashes to 139# typographically correct entities. 140#html_use_smartypants = True 141 142# Custom sidebar templates, maps document names to template names. 143 144html_sidebars = { 145 '**': [ 146 'indexsidebar.html', 147 'sourcelink.html', 148 'searchbox.html', 149 ] 150} 151 152# Additional templates that should be rendered to pages, maps page names to 153# template names. 154#html_additional_pages = {} 155 156# If false, no module index is generated. 157#html_domain_indices = True 158 159# If false, no index is generated. 160#html_use_index = True 161 162# If true, the index is split into individual pages for each letter. 163#html_split_index = False 164 165# If true, links to the reST sources are added to the pages. 166html_show_sourcelink = True 167 168# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. 169#html_show_sphinx = True 170 171# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. 172#html_show_copyright = True 173 174# If true, an OpenSearch description file will be output, and all pages will 175# contain a <link> tag referring to it. The value of this option must be the 176# base URL from which the finished HTML is served. 177#html_use_opensearch = '' 178 179# This is the file name suffix for HTML files (e.g. ".xhtml"). 180#html_file_suffix = None 181 182# Output file base name for HTML help builder. 183htmlhelp_basename = 'LLVMdoc' 184 185 186# -- Options for LaTeX output -------------------------------------------------- 187 188latex_elements = { 189# The paper size ('letterpaper' or 'a4paper'). 190#'papersize': 'letterpaper', 191 192# The font size ('10pt', '11pt' or '12pt'). 193#'pointsize': '10pt', 194 195# Additional stuff for the LaTeX preamble. 196#'preamble': '', 197} 198 199# Grouping the document tree into LaTeX files. List of tuples 200# (source start file, target name, title, author, documentclass [howto/manual]). 201latex_documents = [ 202 ('index', 'LLVM.tex', u'LLVM Documentation', 203 u'LLVM project', 'manual'), 204] 205 206# The name of an image file (relative to this directory) to place at the top of 207# the title page. 208#latex_logo = None 209 210# For "manual" documents, if this is true, then toplevel headings are parts, 211# not chapters. 212#latex_use_parts = False 213 214# If true, show page references after internal links. 215#latex_show_pagerefs = False 216 217# If true, show URL addresses after external links. 218#latex_show_urls = False 219 220# Documents to append as an appendix to all manuals. 221#latex_appendices = [] 222 223# If false, no module index is generated. 224#latex_domain_indices = True 225 226 227# -- Options for manual page output -------------------------------------------- 228 229# One entry per manual page. List of tuples 230# (source start file, name, description, authors, manual section). 231man_pages = [] 232 233# Automatically derive the list of man pages from the contents of the command 234# guide subdirectory. 235basedir = os.path.dirname(__file__) 236man_page_authors = "Maintained by the LLVM Team (https://llvm.org/)." 237command_guide_subpath = 'CommandGuide' 238command_guide_path = os.path.join(basedir, command_guide_subpath) 239manpages_url = '{page}.html' 240 241 242def process_md(name): 243 file_subpath = os.path.join(command_guide_subpath, name) 244 with open(os.path.join(command_guide_path, name)) as f: 245 title = f.readline().rstrip('\n') 246 247 m = re.match(r'^# (\S+) - (.+)$', title) 248 if m is None: 249 print("error: invalid title in %r " 250 "(expected '# <name> - <description>')" % file_subpath, 251 file=sys.stderr) 252 else: 253 man_pages.append((file_subpath.replace('.md',''), m.group(1), 254 m.group(2), man_page_authors, 1)) 255 256 257def process_rst(name): 258 file_subpath = os.path.join(command_guide_subpath, name) 259 with open(os.path.join(command_guide_path, name)) as f: 260 title = f.readline().rstrip('\n') 261 header = f.readline().rstrip('\n') 262 263 if len(header) != len(title): 264 print('error: invalid header in %r (does not match title)' % 265 file_subpath, file=sys.stderr) 266 if ' - ' not in title: 267 print("error: invalid title in %r " 268 "(expected '<name> - <description>')" % file_subpath, 269 file=sys.stderr) 270 # Split the name out of the title. 271 name,description = title.split(' - ', 1) 272 man_pages.append((file_subpath.replace('.rst',''), name, 273 description, man_page_authors, 1)) 274 275 276for name in os.listdir(command_guide_path): 277 # Process Markdown files 278 if name.endswith('.md'): 279 process_md(name) 280 # Process ReST files apart from the index page. 281 elif name.endswith('.rst') and name != 'index.rst': 282 process_rst(name) 283 284# If true, show URL addresses after external links. 285#man_show_urls = False 286 287# FIXME: Define intersphinx configuration. 288intersphinx_mapping = {} 289 290# Pygment lexer are sometimes out of date (when parsing LLVM for example) or 291# wrong. Suppress the warning so the build doesn't abort. 292suppress_warnings = [ 'misc.highlighting_failure' ] 293