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"))
|
||||
(returns (or (get hdef "returns") "element"))
|
||||
(params (or (get hdef "params") (list)))
|
||||
(body (get hdef "body")))
|
||||
(pretty-print
|
||||
(list
|
||||
(make-symbol "defhandler")
|
||||
(make-symbol name)
|
||||
:path path
|
||||
:method (make-keyword method)
|
||||
:csrf csrf
|
||||
:returns returns
|
||||
params
|
||||
body)))))))
|
||||
(body (get hdef "body"))
|
||||
(parts (list (make-symbol "defhandler") (make-symbol name))))
|
||||
(let
|
||||
((parts (append parts (list (make-keyword "path") path)))
|
||||
(parts
|
||||
(append
|
||||
parts
|
||||
(list (make-keyword "method") (make-keyword method))))
|
||||
(parts
|
||||
(if
|
||||
(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"))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user