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)] (let [len (length str)]
(.. str (string.rep " " (- max len))))) (.. str (string.rep " " (- max len)))))
(local mapping-struct-header {:bepo :Bepo :modes :Modes :qwerty :Qwerty})
(fn print-mapping-struct [struct] (fn print-mapping-struct [struct]
(match struct (match struct
{: bepo : modes : qwerty} {: 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)] (let [tbl (collect [name docstruct (pairs bepo)]
(if (= name :setup) (if (= name :setup) nil
nil (= (type docstruct) :table) (values name docstruct)
(values name docstruct)))] (error (.. "Invalid type for " name))))]
(do (do
(table.sort tbl) (table.sort tbl)
(each [name docstruct (pairs tbl)] (each [name docstruct (pairs tbl)]
(do (do
(var need-header true)
(fn print-header []
(do
(print-mapping-struct mapping-struct-header)
(set need-header false)))
(----) (----)
(print-lua-import name) (print-lua-import name)
(-?> docstruct (?. :docstring) print) (-?> docstruct (?. :docstring) print)
(print "") (print "")
(if (> (length docstruct.body) 0) (if (> (length docstruct.body) 0)
(print-mapping-struct {:bepo :Bepo :modes :Modes :qwerty :Qwerty})) (print-header))
(each [_ mapping-struct (pairs docstruct.body)] (each [i mapping-struct (pairs docstruct.body)]
(if need-header (print-hedear))
(match mapping-struct (match mapping-struct
{:comment c} (print c) {:comment c} (do
(print (.. "\n" c))
(set need-header true))
_ (print-mapping-struct mapping-struct))) _ (print-mapping-struct mapping-struct)))
(print ""))))) (print "")))))

View File

@ -62,17 +62,6 @@ require("bepo").window() *bepo.nvim-windo
n wé <C-w>t n wé <C-w>t
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* require("bepo").movement() *bepo.nvim-movement*
on préserve {hjkl} pour les directions 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
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: vim:tw=78:ts=8:ft=help:norl: