mirror of
https://github.com/neovim/neovim.git
synced 2024-12-23 20:55:18 -07:00
gen_vimdoc: Allow to keep intermediary output
This commit is contained in:
parent
b5782c3b81
commit
9d9edebceb
2
.gitignore
vendored
2
.gitignore
vendored
@ -63,6 +63,8 @@ local.mk
|
||||
/runtime/doc/errors.log
|
||||
# Don't include the mpack files.
|
||||
/runtime/doc/*.mpack
|
||||
# Also don't include intermediary doc output
|
||||
/tmp-*-doc
|
||||
|
||||
# CLion
|
||||
/.idea/
|
||||
|
@ -39,6 +39,7 @@ Each function :help block is formatted as follows:
|
||||
parameter is marked as [out].
|
||||
- Each function documentation is separated by a single line.
|
||||
"""
|
||||
import argparse
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
@ -841,7 +842,7 @@ def delete_lines_below(filename, tokenstr):
|
||||
fp.writelines(lines[0:i])
|
||||
|
||||
|
||||
def main(config):
|
||||
def main(config, args=None):
|
||||
"""Generates:
|
||||
|
||||
1. Vim :help docs
|
||||
@ -987,6 +988,7 @@ def main(config):
|
||||
with open(mpack_file, 'wb') as fp:
|
||||
fp.write(msgpack.packb(fn_map_full, use_bin_type=True))
|
||||
|
||||
if not args.keep_tmpfiles:
|
||||
shutil.rmtree(output_dir)
|
||||
|
||||
|
||||
@ -1005,6 +1007,15 @@ def filter_source(filename):
|
||||
fp.read(), flags=re.M))
|
||||
|
||||
|
||||
def parse_args():
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument('source_filter', nargs='*',
|
||||
help="Filter source file(s)")
|
||||
ap.add_argument('-k', '--keep-tmpfiles', action='store_true',
|
||||
help="Keep temporary files")
|
||||
return ap.parse_args()
|
||||
|
||||
|
||||
Doxyfile = textwrap.dedent('''
|
||||
OUTPUT_DIRECTORY = {output}
|
||||
INPUT = {input}
|
||||
@ -1041,9 +1052,10 @@ Doxyfile = textwrap.dedent('''
|
||||
''')
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) > 1:
|
||||
filter_source(sys.argv[1])
|
||||
args = parse_args()
|
||||
if len(args.source_filter) > 0:
|
||||
filter_source(args.source_filter[0])
|
||||
else:
|
||||
main(Doxyfile)
|
||||
main(Doxyfile, args)
|
||||
|
||||
# vim: set ft=python ts=4 sw=4 tw=79 et :
|
||||
|
Loading…
Reference in New Issue
Block a user