improve documentation formatting and pandoc compatibility
look at this shit and tell me you see no problem: https://repology.org/metapackage/pandoc/versions
This commit is contained in:
parent
c5121c1544
commit
58620f1e2b
1 changed files with 48 additions and 5 deletions
|
@ -6,14 +6,52 @@ if get_option('docs')
|
|||
error('pandoc is required to build documentation. Please install it, or disable the `docs` option if you don\'t want it.')
|
||||
endif
|
||||
|
||||
r = run_command(pandoc, '--list-input-formats')
|
||||
|
||||
if r.returncode() != 0
|
||||
error('Couldn\'t retrieve list of input formats supported by pandoc (error code @0@)\n\n@1@'.format(
|
||||
r.returncode(),
|
||||
r.stderr()
|
||||
))
|
||||
endif
|
||||
|
||||
formats = r.stdout().split()
|
||||
input_format = 'ghc'
|
||||
input_format_fallback = 'markdown_github'
|
||||
|
||||
if not formats.contains(input_format)
|
||||
message('pandoc doesn\'t support the \'@0@\' format, falling back to @1@'.format(
|
||||
input_format,
|
||||
input_format_fallback
|
||||
))
|
||||
|
||||
if not formats.contains(input_format_fallback)
|
||||
error('pandoc supports neither \'@0@\' nor \'@1@\''.format(
|
||||
input_format,
|
||||
input_format_fallback
|
||||
))
|
||||
endif
|
||||
|
||||
input_format = input_format_fallback
|
||||
endif
|
||||
|
||||
md_to_html = generator(pandoc,
|
||||
arguments: ['--from', 'markdown_github', '--to', 'html', '--standalone', '@INPUT@', '--output', '@OUTPUT@'],
|
||||
arguments: [
|
||||
'--from', input_format,
|
||||
'--to', 'html5',
|
||||
'--standalone',
|
||||
'--self-contained',
|
||||
'--table-of-contents',
|
||||
'@EXTRA_ARGS@',
|
||||
'@INPUT@',
|
||||
'--output', '@OUTPUT@',
|
||||
],
|
||||
output: '@BASENAME@.html',
|
||||
)
|
||||
|
||||
md_docs = [
|
||||
'ENVIRON.md',
|
||||
'GAME.md',
|
||||
['ENVIRON.md', 'Environment Variables'],
|
||||
['GAME.md', 'Game Manual'],
|
||||
]
|
||||
|
||||
txt_docs = [
|
||||
|
@ -33,11 +71,16 @@ if get_option('docs')
|
|||
)
|
||||
endforeach
|
||||
|
||||
foreach f : md_docs
|
||||
foreach pair : md_docs
|
||||
f = pair[0]
|
||||
title = pair[1]
|
||||
|
||||
name = f.split('.')[0] + '.html'
|
||||
custom_target(name,
|
||||
command : [eolconv, eol, '@INPUT@', '@OUTPUT@'],
|
||||
input : md_to_html.process(f),
|
||||
input : md_to_html.process(f, extra_args : [
|
||||
'--metadata=title=@0@ - Taisei Project'.format(title)
|
||||
]),
|
||||
output : name,
|
||||
install : true,
|
||||
install_dir : doc_path
|
||||
|
|
Loading…
Reference in a new issue