gen_vimdoc.py: mpack: collect functions in 1 dict

All Nvim API, core Vimscript, and core Lua functions are globally
unique, so there is no need for per-module nested dicts.

BEFORE (generated mpack structure):
    [
      {
        "buffer.c": {
          "nvim__buf_stats": { ... },
          ...
        },
        "window.c": {
          "nvim_win_close": { ... },
          ...
        },
        ...
      }
    ]

AFTER (generated mpack structure):
    [
      {
        "nvim__buf_stats": {
          ...
        },
        "nvim_buf_attach": {
          ...
        },
        "nvim_tabpage_set_var": {
          ...
        },
        "nvim_ui_attach": {
          ...
        },
        "nvim_win_close": {
          ...
        }
      }
    ]
This commit is contained in:
Justin M. Keyes 2019-12-19 18:17:43 -08:00
parent f968dad3bf
commit 4657819e80
1 changed files with 3 additions and 3 deletions

View File

@ -729,7 +729,7 @@ def gen_docs(config):
if p.returncode:
sys.exit(p.returncode)
fn_maps = {}
fn_map_full = {} # Collects all functions as each module is processed.
sections = {}
intros = {}
sep = '=' * text_width
@ -800,7 +800,7 @@ def gen_docs(config):
title = '{} Functions'.format(name)
helptag = '*api-{}*'.format(name.lower())
sections[filename] = (title, helptag, doc)
fn_maps[filename] = fn_map
fn_map_full.update(fn_map)
if not sections:
return
@ -833,7 +833,7 @@ def gen_docs(config):
fp.write(docs.encode('utf8'))
with open(mpack_file, 'wb') as fp:
fp.write(msgpack.packb(fn_maps, use_bin_type=True))
fp.write(msgpack.packb(fn_map_full, use_bin_type=True))
shutil.rmtree(output_dir)