aboutsummaryrefslogtreecommitdiff
path: root/scripts/gen_api_vimdoc.py
diff options
context:
space:
mode:
authorPeter Hodge <peter.hodge84@gmail.com>2018-07-25 14:07:55 +1000
committerPeter Hodge <peter.hodge84@gmail.com>2018-07-25 15:07:13 +1000
commit7ab27eeb539aca74c551d79fe082156dbaf76000 (patch)
tree10ec4e6502521e557907f36455615a13f8da03fb /scripts/gen_api_vimdoc.py
parentb53b621ef61ec2ac694437fdcb8385f3d9ee0cbc (diff)
downloadrneovim-7ab27eeb539aca74c551d79fe082156dbaf76000.tar.gz
rneovim-7ab27eeb539aca74c551d79fe082156dbaf76000.tar.bz2
rneovim-7ab27eeb539aca74c551d79fe082156dbaf76000.zip
DOC: add support for intro sections in api docs
Diffstat (limited to 'scripts/gen_api_vimdoc.py')
-rwxr-xr-xscripts/gen_api_vimdoc.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/gen_api_vimdoc.py b/scripts/gen_api_vimdoc.py
index 0bbc3706c6..4e86f15b37 100755
--- a/scripts/gen_api_vimdoc.py
+++ b/scripts/gen_api_vimdoc.py
@@ -413,10 +413,26 @@ def gen_docs(config):
sys.exit(p.returncode)
sections = {}
+ intros = {}
sep = '=' * text_width
base = os.path.join(out_dir, 'xml')
dom = minidom.parse(os.path.join(base, 'index.xml'))
+
+ # generate docs for section intros
+ for compound in dom.getElementsByTagName('compound'):
+ if compound.getAttribute('kind') != 'group':
+ continue
+
+ groupname = get_text(find_first(compound, 'name'))
+ groupxml = os.path.join(base, '%s.xml' % compound.getAttribute('refid'))
+
+ desc = find_first(minidom.parse(groupxml), 'detaileddescription')
+ if desc:
+ doc = parse_parblock(desc)
+ if doc:
+ intros[groupname] = doc
+
for compound in dom.getElementsByTagName('compound'):
if compound.getAttribute('kind') != 'file':
continue
@@ -437,6 +453,11 @@ def gen_docs(config):
name = name.title()
doc = ''
+
+ intro = intros.get('api-%s' % name.lower())
+ if intro:
+ doc += '\n\n' + intro
+
if functions:
doc += '\n\n' + functions