Mercurial > hg > CbC > CbC_llvm
comparison docs/conf.py @ 148:63bd29f05246
merged
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 14 Aug 2019 19:46:37 +0900 |
parents | c2174574ed3a |
children |
comparison
equal
deleted
inserted
replaced
146:3fc4d5c3e21e | 148:63bd29f05246 |
---|---|
7 # Note that not all possible configuration values are present in this | 7 # Note that not all possible configuration values are present in this |
8 # autogenerated file. | 8 # autogenerated file. |
9 # | 9 # |
10 # All configuration values have a default; values that are commented out | 10 # All configuration values have a default; values that are commented out |
11 # serve to show the default. | 11 # serve to show the default. |
12 | 12 from __future__ import print_function |
13 import sys, os | 13 |
14 import sys, os, re | |
14 from datetime import date | 15 from datetime import date |
15 | 16 |
16 # If extensions (or modules to document with autodoc) are in another directory, | 17 # 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 # 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 # documentation root, use os.path.abspath to make it absolute, like shown here. |
29 | 30 |
30 # Add any paths that contain templates here, relative to this directory. | 31 # Add any paths that contain templates here, relative to this directory. |
31 templates_path = ['_templates'] | 32 templates_path = ['_templates'] |
32 | 33 |
33 # The suffix of source filenames. | 34 # The suffix of source filenames. |
34 source_suffix = '.rst' | 35 source_suffix = ['.rst', '.md'] |
36 | |
37 source_parsers = {'.md': 'recommonmark.parser.CommonMarkParser'} | |
35 | 38 |
36 # The encoding of source files. | 39 # The encoding of source files. |
37 #source_encoding = 'utf-8-sig' | 40 #source_encoding = 'utf-8-sig' |
38 | 41 |
39 # The master toctree document. | 42 # The master toctree document. |
46 # The version info for the project you're documenting, acts as replacement for | 49 # The version info for the project you're documenting, acts as replacement for |
47 # |version| and |release|, also used in various other places throughout the | 50 # |version| and |release|, also used in various other places throughout the |
48 # built documents. | 51 # built documents. |
49 # | 52 # |
50 # The short version. | 53 # The short version. |
51 version = '7' | 54 version = '10' |
52 # The full version, including alpha/beta/rc tags. | 55 # The full version, including alpha/beta/rc tags. |
53 release = '7' | 56 release = '10' |
54 | 57 |
55 # The language for content autogenerated by Sphinx. Refer to documentation | 58 # The language for content autogenerated by Sphinx. Refer to documentation |
56 # for a list of supported languages. | 59 # for a list of supported languages. |
57 #language = None | 60 #language = None |
58 | 61 |
215 man_pages = [] | 218 man_pages = [] |
216 | 219 |
217 # Automatically derive the list of man pages from the contents of the command | 220 # Automatically derive the list of man pages from the contents of the command |
218 # guide subdirectory. | 221 # guide subdirectory. |
219 basedir = os.path.dirname(__file__) | 222 basedir = os.path.dirname(__file__) |
220 man_page_authors = "Maintained by The LLVM Team (http://llvm.org/)." | 223 man_page_authors = "Maintained by the LLVM Team (https://llvm.org/)." |
221 command_guide_subpath = 'CommandGuide' | 224 command_guide_subpath = 'CommandGuide' |
222 command_guide_path = os.path.join(basedir, command_guide_subpath) | 225 command_guide_path = os.path.join(basedir, command_guide_subpath) |
223 for name in os.listdir(command_guide_path): | 226 |
224 # Ignore non-ReST files and the index page. | 227 |
225 if not name.endswith('.rst') or name in ('index.rst',): | 228 def process_md(name): |
226 continue | 229 file_subpath = os.path.join(command_guide_subpath, name) |
227 | 230 with open(os.path.join(command_guide_path, name)) as f: |
228 # Otherwise, automatically extract the description. | 231 title = f.readline().rstrip('\n') |
232 | |
233 m = re.match(r'^# (\S+) - (.+)$', title) | |
234 if m is None: | |
235 print("error: invalid title in %r " | |
236 "(expected '# <name> - <description>')" % file_subpath, | |
237 file=sys.stderr) | |
238 else: | |
239 man_pages.append((file_subpath.replace('.md',''), m.group(1), | |
240 m.group(2), man_page_authors, 1)) | |
241 | |
242 | |
243 def process_rst(name): | |
229 file_subpath = os.path.join(command_guide_subpath, name) | 244 file_subpath = os.path.join(command_guide_subpath, name) |
230 with open(os.path.join(command_guide_path, name)) as f: | 245 with open(os.path.join(command_guide_path, name)) as f: |
231 title = f.readline().rstrip('\n') | 246 title = f.readline().rstrip('\n') |
232 header = f.readline().rstrip('\n') | 247 header = f.readline().rstrip('\n') |
233 | 248 |
234 if len(header) != len(title): | 249 if len(header) != len(title): |
235 print >>sys.stderr, ( | 250 print('error: invalid header in %r (does not match title)' % |
236 "error: invalid header in %r (does not match title)" % ( | 251 file_subpath, file=sys.stderr) |
237 file_subpath,)) | |
238 if ' - ' not in title: | 252 if ' - ' not in title: |
239 print >>sys.stderr, ( | 253 print("error: invalid title in %r " |
240 ("error: invalid title in %r " | 254 "(expected '<name> - <description>')" % file_subpath, |
241 "(expected '<name> - <description>')") % ( | 255 file=sys.stderr) |
242 file_subpath,)) | |
243 | |
244 # Split the name out of the title. | 256 # Split the name out of the title. |
245 name,description = title.split(' - ', 1) | 257 name,description = title.split(' - ', 1) |
246 man_pages.append((file_subpath.replace('.rst',''), name, | 258 man_pages.append((file_subpath.replace('.rst',''), name, |
247 description, man_page_authors, 1)) | 259 description, man_page_authors, 1)) |
248 | 260 |
261 | |
262 for name in os.listdir(command_guide_path): | |
263 # Process Markdown files | |
264 if name.endswith('.md'): | |
265 process_md(name) | |
266 # Process ReST files apart from the index page. | |
267 elif name.endswith('.rst') and name != 'index.rst': | |
268 process_rst(name) | |
269 | |
249 # If true, show URL addresses after external links. | 270 # If true, show URL addresses after external links. |
250 #man_show_urls = False | 271 #man_show_urls = False |
251 | 272 |
252 # FIXME: Define intersphinx configuration. | 273 # FIXME: Define intersphinx configuration. |
253 intersphinx_mapping = {} | 274 intersphinx_mapping = {} |
254 | 275 |
255 # Pygment lexer are sometimes out of date (when parsing LLVM for example) or | 276 # Pygment lexer are sometimes out of date (when parsing LLVM for example) or |
256 # wrong. Suppress the warning so the build doesn't abort. | 277 # wrong. Suppress the warning so the build doesn't abort. |
257 suppress_warnings = [ 'misc.highlighting_failure' ] | 278 suppress_warnings = [ 'misc.highlighting_failure' ] |
279 | |
280 # Direct html-ified man pages to llvm.org | |
281 manpages_url = 'https://llvm.org/docs/CommandGuide/{page}.html' |