docs: tweak the script generating the docs

Makes it support comments in the middle of the body
This commit is contained in:
Clément Joly 2022-08-21 23:48:42 +01:00
parent 62d20e3f03
commit 07c301068a
2 changed files with 28 additions and 17 deletions

View File

@ -26,6 +26,8 @@
(let [len (length str)]
(.. str (string.rep " " (- max len)))))
(local mapping-struct-header {:bepo :Bepo :modes :Modes :qwerty :Qwerty})
(fn print-mapping-struct [struct]
(match struct
{: bepo : modes : qwerty}
@ -89,22 +91,31 @@ in each group. “Modes” have the same meaning as in the |map-table|.
")
(let [tbl (collect [name docstruct (pairs bepo)]
(if (= name :setup)
nil
(values name docstruct)))]
(if (= name :setup) nil
(= (type docstruct) :table) (values name docstruct)
(error (.. "Invalid type for " name))))]
(do
(table.sort tbl)
(each [name docstruct (pairs tbl)]
(do
(var need-header true)
(fn print-header []
(do
(print-mapping-struct mapping-struct-header)
(set need-header false)))
(----)
(print-lua-import name)
(-?> docstruct (?. :docstring) print)
(print "")
(if (> (length docstruct.body) 0)
(print-mapping-struct {:bepo :Bepo :modes :Modes :qwerty :Qwerty}))
(each [_ mapping-struct (pairs docstruct.body)]
(print-header))
(each [i mapping-struct (pairs docstruct.body)]
(if need-header (print-hedear))
(match mapping-struct
{:comment c} (print c)
{:comment c} (do
(print (.. "\n" c))
(set need-header true))
_ (print-mapping-struct mapping-struct)))
(print "")))))

View File

@ -62,17 +62,6 @@ require("bepo").window() *bepo.nvim-windo
n wé <C-w>t
n wÉ <C-w>T
--------------------------------------------------------------------------------
require("bepo").tabs() *bepo.nvim-tabs*
le couple [gb]/[gé] agit sur les tabs
Modes Bepo Qwerty
n gb gT
n gé gt
n gB :execute "silent! tabfirst"<CR>
n gÉ :execute "silent! tablast"<CR>
n gT <C-]>
--------------------------------------------------------------------------------
require("bepo").movement() *bepo.nvim-movement*
on préserve {hjkl} pour les directions
@ -118,5 +107,16 @@ require("bepo").easy_access() *bepo.nvim-easy_acces
ox ié iw
ox iÉ iW
--------------------------------------------------------------------------------
require("bepo").tabs() *bepo.nvim-tabs*
le couple [gb]/[gé] agit sur les tabs
Modes Bepo Qwerty
n gb gT
n gé gt
n gB :execute "silent! tabfirst"<CR>
n gÉ :execute "silent! tablast"<CR>
n gT <C-]>
vim:tw=78:ts=8:ft=help:norl: