Add Special Forms docs page at /docs/special-forms
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 3m54s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 3m54s
Parses special-forms.sx spec into categorized form cards with syntax, description, tail-position info, and highlighted examples. Follows the same pattern as the Primitives page: Python helper returns structured data, .sx components render it. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -123,3 +123,40 @@
|
||||
:category cat
|
||||
:primitives (get primitives cat)))
|
||||
(keys primitives))))
|
||||
|
||||
;; Build all special form category sections from a {category: [form, ...]} dict.
|
||||
(defcomp ~doc-special-forms-tables (&key forms)
|
||||
(<> (map (fn (cat)
|
||||
(~doc-special-forms-category
|
||||
:category cat
|
||||
:forms (get forms cat)))
|
||||
(keys forms))))
|
||||
|
||||
(defcomp ~doc-special-forms-category (&key category forms)
|
||||
(div :class "space-y-4"
|
||||
(h3 :class "text-xl font-semibold text-stone-800 border-b border-stone-200 pb-2" category)
|
||||
(div :class "space-y-4"
|
||||
(map (fn (f)
|
||||
(~doc-special-form-card
|
||||
:name (get f "name")
|
||||
:syntax (get f "syntax")
|
||||
:doc (get f "doc")
|
||||
:tail-position (get f "tail-position")
|
||||
:example (get f "example")))
|
||||
forms))))
|
||||
|
||||
(defcomp ~doc-special-form-card (&key name syntax doc tail-position example)
|
||||
(div :class "border border-stone-200 rounded-lg p-4 space-y-3"
|
||||
(div :class "flex items-baseline gap-3"
|
||||
(code :class "text-lg font-bold text-violet-700" name)
|
||||
(when (not (= tail-position "none"))
|
||||
(span :class "text-xs px-2 py-0.5 rounded-full bg-green-100 text-green-700" "TCO")))
|
||||
(when (not (= syntax ""))
|
||||
(pre :class "bg-stone-50 rounded px-3 py-2 text-sm font-mono text-stone-700 overflow-x-auto"
|
||||
syntax))
|
||||
(p :class "text-stone-600 text-sm whitespace-pre-line" doc)
|
||||
(when (not (= tail-position ""))
|
||||
(p :class "text-xs text-stone-500"
|
||||
(span :class "font-semibold" "Tail position: ") tail-position))
|
||||
(when (not (= example ""))
|
||||
(~doc-code :code (highlight example "lisp")))))
|
||||
|
||||
Reference in New Issue
Block a user