|
1 | 1 | #!/usr/bin/env sh |
2 | 2 |
|
3 | | -# Wrapper around Nvim make targets: |
| 3 | +# Wrapper around Nvim make doc target: |
4 | 4 | # |
5 | | -# make doc - gen_vimdoc.lua |
6 | | -# Generates doc/nvim-tree-lua.txt |
7 | | -# Uses nvim-tree sources defined in scripts/vimdoc_config.lua |
8 | | -# Shims above into src/gen/gen_vimdoc.lua, replacing Nvim's config. |
9 | | -# |
10 | | -# make lintdoc - lintdoc.lua |
11 | | -# Validates doc/nvim-tree-lua.txt |
12 | | -# Desired: |
13 | | -# - tags valid |
14 | | -# - links valid |
15 | | -# Also: |
16 | | -# - brand spelling, notably Nvim and Lua |
| 5 | +# Generates doc/nvim-tree-lua.txt |
| 6 | +# Uses nvim-tree sources defined in scripts/vimdoc_config.lua |
| 7 | +# Shims above into src/gen/gen_vimdoc.lua, replacing Nvim's config. |
17 | 8 | # |
18 | 9 | # There are some hardcoded expectations which we work around as commented. |
19 | 10 |
|
20 | 11 | set -e |
21 | 12 |
|
22 | | -if [ $# -ne 1 ] || [ "${1}" != "doc" ] && [ "${1}" != "lintdoc" ]; then |
23 | | - echo "usage: ${0} <doc|lintdoc>" 1>&2 |
| 13 | +if [ $# -ne 1 ] || [ "${1}" != "doc" ]; then |
| 14 | + echo "usage: ${0} <doc>" 1>&2 |
24 | 15 | exit 1 |
25 | 16 | fi |
26 | 17 |
|
|
38 | 29 | if [ ! -d "${DIR_NVIM_SRC}" ]; then |
39 | 30 | cat << EOM |
40 | 31 |
|
41 | | -Nvim source v0.11+ is required to run ${0} |
| 32 | +Nvim stable source is required to run ${0} |
42 | 33 |
|
43 | 34 | Unavailable: ${DIR_NVIM_SRC_DEF} or \$DIR_NVIM_SRC=${DIR_NVIM_SRC} |
44 | 35 |
|
@@ -84,7 +75,15 @@ if [ "${1}" = "doc" ]; then |
84 | 75 |
|
85 | 76 | # modify gen_vimdoc.lua to use our config, backing up original |
86 | 77 | cp "${DIR_NVIM_SRC}/src/gen/gen_vimdoc.lua" "${DIR_NVIM_SRC}/src/gen/gen_vimdoc.lua.org" |
87 | | - sed -i -E 's/spairs\(config\)/spairs\(require("gen.vimdoc_config")\)/g' "${DIR_NVIM_SRC}/src/gen/gen_vimdoc.lua" |
| 78 | + sed -i -E ' |
| 79 | +
|
| 80 | + # use our config |
| 81 | + s/spairs\(config\)/spairs\(require("gen.vimdoc_config") --[[injected by nvim-tree]]\)/g ; |
| 82 | +
|
| 83 | + # remove the name linter |
| 84 | + s/(^run\(\)$)/\n--injected by nvim-tree\nlint.lint_names = function\(\)\nend\n\n\1 --/g |
| 85 | +
|
| 86 | + ' "${DIR_NVIM_SRC}/src/gen/gen_vimdoc.lua" |
88 | 87 |
|
89 | 88 | # leave a generic placeholder to bridge between nvim.gen_vimdoc.Config |
90 | 89 | echo "---@brief placeholder" > "${DIR_NVIM_SRC}/runtime/lua/placeholder.lua" |
|
0 commit comments