diff options
| author | Andrey Orst <andreyorst@gmail.com> | 2020-11-14 16:51:51 +0300 |
|---|---|---|
| committer | Andrey Orst <andreyorst@gmail.com> | 2020-11-14 16:55:11 +0300 |
| commit | 4ea70bf39971eeb742a5de689a9ad8ba63559ecb (patch) | |
| tree | 0c8268316eff16ca5b066063b29ea410c0405336 /cljlib-macros.fnl | |
| parent | 612d8185384ca77347ed89d02c45b91cd9dcd57a (diff) | |
Feature(doc): upload autogenerated documentation.
Diffstat (limited to 'cljlib-macros.fnl')
| -rw-r--r-- | cljlib-macros.fnl | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/cljlib-macros.fnl b/cljlib-macros.fnl index e49713f..e62c185 100644 --- a/cljlib-macros.fnl +++ b/cljlib-macros.fnl @@ -74,18 +74,26 @@ Strings are transformed into a sequence of letters." (fn gen-arglist-doc [args] (if (list? (. args 1)) (let [arglist [] - open (if (> (length args) 1) "\n [" "") - close (if (= open "") "" "]")] + newline? (if (> (length args) 1) "\n (" "(")] (each [i v (ipairs args)] - (table.insert - arglist - (.. open (table.concat (gen-arglist-doc v) " ") close))) + (let [arglist-doc (gen-arglist-doc v)] + (when (next arglist-doc) + (table.insert + arglist + (.. newline? (table.concat arglist-doc " ") ")"))))) arglist) (sequence? (. args 1)) - (let [arglist []] - (each [_ v (ipairs (. args 1))] - (table.insert arglist (tostring v))) + (let [arglist [] + args (. args 1) + len (length args)] + (each [i v (ipairs args)] + (table.insert arglist + (match i + (1 ? (= len 1)) (.. "[" (tostring v) "]") + 1 (.. "[" (tostring v)) + len (.. (tostring v) "]") + _ (tostring v)))) arglist))) (fn multisym->sym [s] |