liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit d7785d9d75ed6923b9f2f22f41e24db9cea3c720
parent f93c03c98a40f8297951b8a620946e93a6cde3e8
Author: Daniel Barlow <dan@telent.net>
Date:   Sat, 12 Aug 2023 20:49:16 +0100

if no preamble, print module pathname as headline

this was supposed to work already but was broken

Diffstat:
Mdoc/parse-options.fnl | 9++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/doc/parse-options.fnl b/doc/parse-options.fnl @@ -3,10 +3,9 @@ (local { : view } (require :fennel)) (fn headline [name] - (let [(_ _ basename) (string.find name ".*/([^/].*)") + (let [(_ _ basename) (string.find name ".*/([^/].*).nix") len (basename:len)] - (print basename) - (print (string.rep "=" len)))) + (.. basename "\n" (string.rep "=" len)))) (fn read-preamble [pathname] (if (= (pathname:sub 1 1) "/") @@ -14,10 +13,10 @@ pathname (.. pathname "/default.nix"))] (with-open [f (assert (io.open pathname :r))] - (accumulate [lines "" + (accumulate [lines nil l (f:lines) :until (not (= (string.sub l 1 2) "##"))] - (.. lines (string.gsub l "^## *" "") "\n")))))) + (.. (or lines "") (string.gsub l "^## *" "") "\n")))))) (fn strip-newlines [text] (-> text