aboutsummaryrefslogtreecommitdiff
path: root/scripts/gen_api_vimdoc.py
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-11-06 20:23:35 +0300
committerZyX <kp-pav@yandex.ru>2017-11-06 20:23:35 +0300
commit24a353364d6d186d528009fd0bb603d87183cf35 (patch)
treea4070dc00731475d6bbdd3c84e61806b33802f7a /scripts/gen_api_vimdoc.py
parentf2660bee6aca35be3d0ddb1d225784476c13cd27 (diff)
parent946c2a8ee85830c543e389724575ae531e89b170 (diff)
downloadrneovim-24a353364d6d186d528009fd0bb603d87183cf35.tar.gz
rneovim-24a353364d6d186d528009fd0bb603d87183cf35.tar.bz2
rneovim-24a353364d6d186d528009fd0bb603d87183cf35.zip
Merge branch 'master' into expression-parser
Diffstat (limited to 'scripts/gen_api_vimdoc.py')
-rw-r--r--scripts/gen_api_vimdoc.py22
1 files changed, 18 insertions, 4 deletions
diff --git a/scripts/gen_api_vimdoc.py b/scripts/gen_api_vimdoc.py
index 4dcb42d685..51e585a007 100644
--- a/scripts/gen_api_vimdoc.py
+++ b/scripts/gen_api_vimdoc.py
@@ -38,6 +38,10 @@ import subprocess
from xml.dom import minidom
+if sys.version_info[0] < 3:
+ print("use Python 3")
+ sys.exit(1)
+
doc_filename = 'api.txt'
# String used to find the start of the generated part of the doc.
section_start_token = '*api-global*'
@@ -69,7 +73,7 @@ text_width = 78
script_path = os.path.abspath(__file__)
base_dir = os.path.dirname(os.path.dirname(script_path))
src_dir = os.path.join(base_dir, 'src/nvim/api')
-out_dir = os.path.join(base_dir, 'tmp/api_doc')
+out_dir = os.path.join(base_dir, 'tmp-api-doc')
filter_cmd = '%s %s' % (sys.executable, script_path)
seen_funcs = set()
@@ -217,7 +221,12 @@ def parse_para(parent, width=62):
width=width) + '\n')
elif child.nodeName == 'simplesect':
kind = child.getAttribute('kind')
- if kind == 'return':
+ if kind == 'note':
+ lines.append('Note:')
+ lines.append(doc_wrap(parse_para(child),
+ prefix=' ',
+ width=width))
+ elif kind == 'return':
lines.append('%s:~' % kind.title())
lines.append(doc_wrap(parse_para(child),
prefix=' ',
@@ -280,14 +289,19 @@ def parse_source_xml(filename):
parts = return_type.strip('_').split('_')
return_type = '%s(%s)' % (parts[0], ', '.join(parts[1:]))
+ name = get_text(get_child(member, 'name'))
+
annotations = get_text(get_child(member, 'argsstring'))
if annotations and ')' in annotations:
annotations = annotations.rsplit(')', 1)[-1].strip()
+ # XXX: (doxygen 1.8.11) 'argsstring' only includes FUNC_ATTR_*
+ # attributes if the function signature is non-void.
+ # Force attributes here for such functions.
+ if name == 'nvim_get_mode' and len(annotations) == 0:
+ annotations += 'FUNC_API_ASYNC'
annotations = filter(None, map(lambda x: annotation_map.get(x),
annotations.split()))
- name = get_text(get_child(member, 'name'))
-
vimtag = '*%s()*' % name
args = []
type_length = 0