handler-source: fix keywords, add syntax highlighting
Keywords were printed as strings because list treated :path as kwargs. Now uses make-keyword to build keyword nodes. Output goes through highlight for syntax coloring. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -38,17 +38,26 @@
|
|||||||
(csrf (get hdef "csrf"))
|
(csrf (get hdef "csrf"))
|
||||||
(returns (or (get hdef "returns") "element"))
|
(returns (or (get hdef "returns") "element"))
|
||||||
(params (or (get hdef "params") (list)))
|
(params (or (get hdef "params") (list)))
|
||||||
(body (get hdef "body")))
|
(body (get hdef "body"))
|
||||||
(pretty-print
|
(parts (list (make-symbol "defhandler") (make-symbol name))))
|
||||||
(list
|
(let
|
||||||
(make-symbol "defhandler")
|
((parts (append parts (list (make-keyword "path") path)))
|
||||||
(make-symbol name)
|
(parts
|
||||||
:path path
|
(append
|
||||||
:method (make-keyword method)
|
parts
|
||||||
:csrf csrf
|
(list (make-keyword "method") (make-keyword method))))
|
||||||
:returns returns
|
(parts
|
||||||
params
|
(if
|
||||||
body)))))))
|
(not csrf)
|
||||||
|
(append parts (list (make-keyword "csrf") false))
|
||||||
|
parts))
|
||||||
|
(parts
|
||||||
|
(if
|
||||||
|
(not (= returns "element"))
|
||||||
|
(append parts (list (make-keyword "returns") returns))
|
||||||
|
parts))
|
||||||
|
(parts (append parts (list params body))))
|
||||||
|
(highlight (pretty-print parts))))))))
|
||||||
|
|
||||||
(define _spec-dirs (list "spec" "web" "shared/sx/ref" "lib"))
|
(define _spec-dirs (list "spec" "web" "shared/sx/ref" "lib"))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user