|
32 | 32 | templates_path = ['_templates']
|
33 | 33 |
|
34 | 34 | # The suffix of source filenames.
|
35 |
| -source_suffix = '.rst' |
| 35 | +source_suffix = { |
| 36 | + '.rst': 'restructuredtext', |
| 37 | +} |
| 38 | + |
| 39 | +try: |
| 40 | + import recommonmark |
| 41 | +except ImportError: |
| 42 | + # manpages do not use any .md sources |
| 43 | + if not tags.has('builder-man'): |
| 44 | + raise |
| 45 | +else: |
| 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' |
36 | 53 |
|
37 | 54 | # The encoding of source files.
|
38 | 55 | #source_encoding = 'utf-8-sig'
|
|
233 | 250 | # If true, show URL addresses after external links.
|
234 | 251 | #man_show_urls = False
|
235 | 252 |
|
| 253 | +def process_md(name): |
| 254 | + file_subpath = os.path.join(command_guide_subpath, name) |
| 255 | + with open(os.path.join(command_guide_path, name)) as f: |
| 256 | + title = f.readline().rstrip('\n') |
| 257 | + |
| 258 | + m = re.match(r'^# (\S+) - (.+)$', title) |
| 259 | + if m is None: |
| 260 | + print("error: invalid title in %r " |
| 261 | + "(expected '# <name> - <description>')" % file_subpath, |
| 262 | + file=sys.stderr) |
| 263 | + else: |
| 264 | + man_pages.append((file_subpath.replace('.md',''), m.group(1), |
| 265 | + m.group(2), man_page_authors, 1)) |
236 | 266 |
|
237 | 267 | # -- Options for Texinfo output ------------------------------------------------
|
238 | 268 |
|
|
0 commit comments