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