mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06: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
|
/runtime/doc/errors.log
|
||||||
# Don't include the mpack files.
|
# Don't include the mpack files.
|
||||||
/runtime/doc/*.mpack
|
/runtime/doc/*.mpack
|
||||||
|
# Also don't include intermediary doc output
|
||||||
|
/tmp-*-doc
|
||||||
|
|
||||||
# CLion
|
# CLion
|
||||||
/.idea/
|
/.idea/
|
||||||
|
@ -39,6 +39,7 @@ Each function :help block is formatted as follows:
|
|||||||
parameter is marked as [out].
|
parameter is marked as [out].
|
||||||
- Each function documentation is separated by a single line.
|
- Each function documentation is separated by a single line.
|
||||||
"""
|
"""
|
||||||
|
import argparse
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
@ -841,7 +842,7 @@ def delete_lines_below(filename, tokenstr):
|
|||||||
fp.writelines(lines[0:i])
|
fp.writelines(lines[0:i])
|
||||||
|
|
||||||
|
|
||||||
def main(config):
|
def main(config, args=None):
|
||||||
"""Generates:
|
"""Generates:
|
||||||
|
|
||||||
1. Vim :help docs
|
1. Vim :help docs
|
||||||
@ -987,6 +988,7 @@ def main(config):
|
|||||||
with open(mpack_file, 'wb') as fp:
|
with open(mpack_file, 'wb') as fp:
|
||||||
fp.write(msgpack.packb(fn_map_full, use_bin_type=True))
|
fp.write(msgpack.packb(fn_map_full, use_bin_type=True))
|
||||||
|
|
||||||
|
if not args.keep_tmpfiles:
|
||||||
shutil.rmtree(output_dir)
|
shutil.rmtree(output_dir)
|
||||||
|
|
||||||
|
|
||||||
@ -1005,6 +1007,15 @@ def filter_source(filename):
|
|||||||
fp.read(), flags=re.M))
|
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('''
|
Doxyfile = textwrap.dedent('''
|
||||||
OUTPUT_DIRECTORY = {output}
|
OUTPUT_DIRECTORY = {output}
|
||||||
INPUT = {input}
|
INPUT = {input}
|
||||||
@ -1041,9 +1052,10 @@ Doxyfile = textwrap.dedent('''
|
|||||||
''')
|
''')
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
if len(sys.argv) > 1:
|
args = parse_args()
|
||||||
filter_source(sys.argv[1])
|
if len(args.source_filter) > 0:
|
||||||
|
filter_source(args.source_filter[0])
|
||||||
else:
|
else:
|
||||||
main(Doxyfile)
|
main(Doxyfile, args)
|
||||||
|
|
||||||
# vim: set ft=python ts=4 sw=4 tw=79 et :
|
# vim: set ft=python ts=4 sw=4 tw=79 et :
|
||||||
|
Loading…
Reference in New Issue
Block a user