mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 19:38:20 +00:00
gen_api_vimdoc.py: require "nvim_" prefix
Avoids doxygen bugs (things that aren't functions) and other noise (e.g. `remote_ui_disconnect()` was incorrectly included in api.txt).
This commit is contained in:
@@ -45,6 +45,8 @@ if sys.version_info[0] < 3:
|
|||||||
doc_filename = 'api.txt'
|
doc_filename = 'api.txt'
|
||||||
# String used to find the start of the generated part of the doc.
|
# String used to find the start of the generated part of the doc.
|
||||||
section_start_token = '*api-global*'
|
section_start_token = '*api-global*'
|
||||||
|
# Required prefix for API function names.
|
||||||
|
api_func_name_prefix = 'nvim_'
|
||||||
|
|
||||||
# Section name overrides.
|
# Section name overrides.
|
||||||
section_name = {
|
section_name = {
|
||||||
@@ -260,11 +262,11 @@ def parse_parblock(parent, width=62):
|
|||||||
def parse_source_xml(filename):
|
def parse_source_xml(filename):
|
||||||
"""Collects API functions.
|
"""Collects API functions.
|
||||||
|
|
||||||
This returns two strings:
|
Returns two strings:
|
||||||
1. The API functions
|
1. API functions
|
||||||
2. The deprecated API functions
|
2. Deprecated API functions
|
||||||
|
|
||||||
The caller decides what to do with the deprecated documentation.
|
Caller decides what to do with the deprecated documentation.
|
||||||
"""
|
"""
|
||||||
global xrefs
|
global xrefs
|
||||||
xrefs = set()
|
xrefs = set()
|
||||||
@@ -294,9 +296,8 @@ def parse_source_xml(filename):
|
|||||||
annotations = get_text(get_child(member, 'argsstring'))
|
annotations = get_text(get_child(member, 'argsstring'))
|
||||||
if annotations and ')' in annotations:
|
if annotations and ')' in annotations:
|
||||||
annotations = annotations.rsplit(')', 1)[-1].strip()
|
annotations = annotations.rsplit(')', 1)[-1].strip()
|
||||||
# XXX: (doxygen 1.8.11) 'argsstring' only includes FUNC_ATTR_*
|
# XXX: (doxygen 1.8.11) 'argsstring' only includes attributes of
|
||||||
# attributes if the function signature is non-void.
|
# non-void functions. Special-case void functions here.
|
||||||
# Force attributes here for such functions.
|
|
||||||
if name == 'nvim_get_mode' and len(annotations) == 0:
|
if name == 'nvim_get_mode' and len(annotations) == 0:
|
||||||
annotations += 'FUNC_API_ASYNC'
|
annotations += 'FUNC_API_ASYNC'
|
||||||
annotations = filter(None, map(lambda x: annotation_map.get(x),
|
annotations = filter(None, map(lambda x: annotation_map.get(x),
|
||||||
@@ -379,7 +380,7 @@ def parse_source_xml(filename):
|
|||||||
|
|
||||||
if 'Deprecated' in xrefs:
|
if 'Deprecated' in xrefs:
|
||||||
deprecated_functions.append(func_doc)
|
deprecated_functions.append(func_doc)
|
||||||
else:
|
elif name.startswith(api_func_name_prefix):
|
||||||
functions.append(func_doc)
|
functions.append(func_doc)
|
||||||
|
|
||||||
xrefs.clear()
|
xrefs.clear()
|
||||||
|
Reference in New Issue
Block a user