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