docs are closer to working
This commit is contained in:
parent
0068662c8b
commit
bb420adbf9
@ -1,5 +1,5 @@
|
|||||||
"work in progress script to generate /src/fennel-ls/docs/lua54.fnl automatically"
|
"work in progress script to generate /src/fennel-ls/docs/lua54.fnl automatically"
|
||||||
|
(local {: view} (require :fennel))
|
||||||
(local version "5.4")
|
(local version "5.4")
|
||||||
(local filename (.. "lua" version ".html"))
|
(local filename (.. "lua" version ".html"))
|
||||||
(var file (io.open filename :r))
|
(var file (io.open filename :r))
|
||||||
@ -26,8 +26,8 @@
|
|||||||
(if index
|
(if index
|
||||||
(do
|
(do
|
||||||
(table.insert module-items (section:sub 1 (- index 1)))
|
(table.insert module-items (section:sub 1 (- index 1)))
|
||||||
(table.insert modules (section:sub index))))
|
(table.insert modules (section:sub index)))
|
||||||
(table.insert module-items section))
|
(table.insert module-items section)))
|
||||||
(when header (loop header))))
|
(when header (loop header))))
|
||||||
(loop (stdlib:find "<hr><h3>.-\n"))
|
(loop (stdlib:find "<hr><h3>.-\n"))
|
||||||
|
|
||||||
@ -74,16 +74,20 @@
|
|||||||
description (description:gsub "<code>(.-)</code>" "`%1`")
|
description (description:gsub "<code>(.-)</code>" "`%1`")
|
||||||
description (description:gsub " " " ")
|
description (description:gsub " " " ")
|
||||||
description (description:gsub "–" "–")
|
description (description:gsub "–" "–")
|
||||||
description (description:gsub "—" "—")]
|
description (description:gsub "—" "—")
|
||||||
|
name (signature:match "[^() ]+")
|
||||||
|
key (name:match "[^.:]+$")
|
||||||
|
?module (and (name:find "[.:]") (name:match "^[^.:]+"))]
|
||||||
|
|
||||||
(assert (not (signature:find "[%[%]]")) (.. "bad signature " signature))
|
(assert (not (signature:find "[%[%]]")) (.. "bad signature " signature))
|
||||||
;; Debug prints for now.
|
;; Debug prints for now.
|
||||||
(when false
|
(when (not ?module)
|
||||||
(print "=============")
|
(print
|
||||||
(print "```fnl")
|
(.. (view ?module)
|
||||||
(print signature)
|
(view key)
|
||||||
(print "```")
|
" "
|
||||||
(print description))))
|
(view {:binding (signature:match "[^() ]+")
|
||||||
|
:metadata {:fnl/docstring description}}))))))
|
||||||
|
|
||||||
|
|
||||||
(var done false)
|
(var done false)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user