3.5.2 Page Content
(require conscript/struct) | package: conscript |
struct
(struct study-page (renderer xexpr-validator))
renderer : (-> xexpr?) xexpr-validator : (-> any/c xexpr?)
Any definition of a study step must be a function that produces a study-page. (or another study, but we won’t go into that here). But you should never need to create these values directly; rather, you’ll typically use helper functions like md and html that do this for you.
> (define x (md "# Heading")) > x (step-page #<procedure:render> #<procedure:validate-xexpr>)
> (x) '(div ((class "container")) (div () (h1 "Heading")))
3.5.2.1 Markdown
(require conscript/markdown) | package: conscript |
The bindings provided by this module are also provided by conscript/base.
> (md "# Heading") (step-page #<procedure:render> #<procedure:validate-xexpr>)
> (md* "# Heading") '(div () (h1 "Heading"))
3.5.2.2 HTML
(require conscript/html) | package: conscript |
The bindings in this module are also provided by conscript/base.
> (html (div "content...")) (step-page #<procedure:render> #<procedure:validate-xexpr>)
> (html* (div "content...")) '(div () (div () (p () "content...")))
syntax
(a #:href href content ...)
syntax
(aside content ...)
syntax
(audio #:src src content ...)
syntax
(blockquote content ...)
syntax
(br)
syntax
(dd content ...)
syntax
(div content ...)
syntax
(dt content ...)
syntax
(em content ...)
syntax
(h1 content ...)
syntax
(h2 content ...)
syntax
(h3 content ...)
syntax
(h4 content ...)
syntax
(h5 content ...)
syntax
(h6 content ...)
syntax
(img #:alt alt #:src src content ...)
syntax
(label content ...)
syntax
(li content ...)
syntax
(ol content ...)
syntax
(output content ...)
syntax
(p content ...)
syntax
(pre content ...)
syntax
(script content ...)
syntax
(section content ...)
syntax
(span content ...)
syntax
(strong content ...)
syntax
(style content ...)
syntax
(table content ...)
syntax
(tbody content ...)
syntax
(td content ...)
syntax
(th content ...)
syntax
(thead content ...)
syntax
(tr content ...)
syntax
(u content ...)
syntax
(ul content ...)
syntax
(video #:src src content ...)
content : xexpr?
Any keyword arguments supplied are converted attribute names/values in the resulting HTML representation. Keyword arguments specifically noted above are required for their respective forms.
> (a #:href "/" "a link") '(a ((href "/")) "a link")
> (a "/" "a link") a: missing required keyword argument: #:href
> (a #:class "my-style" #:href "/" "styled link") '(a ((class "my-style") (href "/")) "styled link")
3.5.2.3 Forms
(require conscript/form) | package: conscript |
The bindings in this module are also provided by conscript/base.
3.5.2.4 Resources
(require conscript/resource) | package: conscript |