From bb420adbf99e674562120074297924eea3f49aec Mon Sep 17 00:00:00 2001 From: XeroOl Date: Mon, 13 May 2024 02:24:27 -0500 Subject: [PATCH] docs are closer to working --- make-docs.fnl | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/make-docs.fnl b/make-docs.fnl index 43730b8..5696195 100644 --- a/make-docs.fnl +++ b/make-docs.fnl @@ -1,5 +1,5 @@ "work in progress script to generate /src/fennel-ls/docs/lua54.fnl automatically" - +(local {: view} (require :fennel)) (local version "5.4") (local filename (.. "lua" version ".html")) (var file (io.open filename :r)) @@ -26,8 +26,8 @@ (if index (do (table.insert module-items (section:sub 1 (- index 1))) - (table.insert modules (section:sub index)))) - (table.insert module-items section)) + (table.insert modules (section:sub index))) + (table.insert module-items section))) (when header (loop header)))) (loop (stdlib:find "

.-\n")) @@ -74,16 +74,20 @@ description (description:gsub "(.-)" "`%1`") 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)) ;; Debug prints for now. - (when false - (print "=============") - (print "```fnl") - (print signature) - (print "```") - (print description)))) + (when (not ?module) + (print + (.. (view ?module) + (view key) + " " + (view {:binding (signature:match "[^() ]+") + :metadata {:fnl/docstring description}})))))) (var done false)