► |  | Scribble as Preprocessor

1 | Text Generation
2 | HTML Generation
| Index

▼ | 2 | HTML Generation

2.1 | Generating HTML Strings
2.2 | Generating XML Strings
2.3 | HTML Resources

► | 2.1 | Generating HTML Strings

2.1.1 | Other HTML elements

On this page:

doctype
xhtml
html
head
title
style
script
noscript
slot
frameset
frame
iframe
noframes
body
div
p
h1
h2
h3
h4
h5
h6
hgroup
ul
ol
menu
dir
li
dl
dt
dd
address
pre
blockquote
center
ins
del
a
span
bdo
em
strong
dfn
code
samp
kbd
var
cite
abbr
acronym
q
sub
sup
tt
i
b
big
small
u
s
strike
font
object
applet
form
label
select
optgroup
option
textarea
fieldset
legend
button
table
caption
thead
tfoot
tbody
colgroup
tr
th
td
details
dialog
menuitem
base
meta
link
hr
br
basefont
param
img
area
input
isindex
col
embed
keygen
wbr
nbsp
ndash
mdash
bull
middot
sdot
lsquo
rsquo
sbquo
ldquo
rdquo
bdquo
lang
rang
dagger
Dagger
plusmn
deg
script/ inline
style/ inline
2.1.1`` Other HTML elements
article
aside
audio
bdi
canvas
data
datalist
figcaption
figure
footer
header
main
map
mark
math
meter
nav
output
picture
progress
rb
rp
rt
rtc
ruby
section
summary
svg
template
time
video
source
track

top ← prev up next →

#### 2.1`` Generating HTML Strings

(require scribble/html/html) | package: scribble-html-lib

The scribble/html/html provides functions for HTML representations that render to string form via output-xml.

> procedure (doctype s) → procedure?
> s : (or/c string 'html 'xhtml)

Produces a value that XML-renders as a DOCTYPE declaration.

Examples:

> > (output-xml (doctype "?"))
> <!DOCTYPE ?>
> > (output-xml (doctype 'html))
> <!DOCTYPE html>
> > (regexp-split #rx"\n|((?<=\") (?=\"))"
> (xml->string (doctype 'xhtml)))
> '("<?xml version=\"1.0\" encoding=\"utf-8\"?>"
> "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\""
> "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">"
> "")

> procedure (xhtml content ...) → procedure?
> content : outputable/c

Produces a value that XML-renders as the given content wrapped as XHTML.

Example:

> > (regexp-split #rx"\n|((?<=\") (?=\"))"
> (xml->string (xhtml "Hello")))
> '("<?xml version=\"1.0\" encoding=\"utf-8\"?>"
> "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\""
> "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">"
> "<html xmlns=\"http://www.w3.org/1999/xhtml\">Hello</html>"
> "")

> procedure (html v ...) → procedure?
> v : outputable/c
> procedure (head v ...) → procedure?
> v : outputable/c
> procedure (title v ...) → procedure?
> v : outputable/c
> procedure (style v ...) → procedure?
> v : outputable/c
> procedure (script v ...) → procedure?
> v : outputable/c
> procedure (noscript v ...) → procedure?
> v : outputable/c
> procedure (slot v ...) → procedure?
> v : outputable/c
> procedure (frameset v ...) → procedure?
> v : outputable/c
> procedure (frame v ...) → procedure?
> v : outputable/c
> procedure (iframe v ...) → procedure?
> v : outputable/c
> procedure (noframes v ...) → procedure?
> v : outputable/c
> procedure (body v ...) → procedure?
> v : outputable/c
> procedure (div v ...) → procedure?
> v : outputable/c
> procedure (p v ...) → procedure?
> v : outputable/c
> procedure (h1 v ...) → procedure?
> v : outputable/c
> procedure (h2 v ...) → procedure?
> v : outputable/c
> procedure (h3 v ...) → procedure?
> v : outputable/c
> procedure (h4 v ...) → procedure?
> v : outputable/c
> procedure (h5 v ...) → procedure?
> v : outputable/c
> procedure (h6 v ...) → procedure?
> v : outputable/c
> procedure (hgroup v ...) → procedure?
> v : outputable/c
> procedure (ul v ...) → procedure?
> v : outputable/c
> procedure (ol v ...) → procedure?
> v : outputable/c
> procedure (menu v ...) → procedure?
> v : outputable/c
> procedure (dir v ...) → procedure?
> v : outputable/c
> procedure (li v ...) → procedure?
> v : outputable/c
> procedure (dl v ...) → procedure?
> v : outputable/c
> procedure (dt v ...) → procedure?
> v : outputable/c
> procedure (dd v ...) → procedure?
> v : outputable/c
> procedure (address v ...) → procedure?
> v : outputable/c
> procedure (pre v ...) → procedure?
> v : outputable/c
> procedure (blockquote v ...) → procedure?
> v : outputable/c
> procedure (center v ...) → procedure?
> v : outputable/c
> procedure (ins v ...) → procedure?
> v : outputable/c
> procedure (del v ...) → procedure?
> v : outputable/c
> procedure (a v ...) → procedure?
> v : outputable/c
> procedure (span v ...) → procedure?
> v : outputable/c
> procedure (bdo v ...) → procedure?
> v : outputable/c
> procedure (em v ...) → procedure?
> v : outputable/c
> procedure (strong v ...) → procedure?
> v : outputable/c
> procedure (dfn v ...) → procedure?
> v : outputable/c
> procedure (code v ...) → procedure?
> v : outputable/c
> procedure (samp v ...) → procedure?
> v : outputable/c
> procedure (kbd v ...) → procedure?
> v : outputable/c
> procedure (var v ...) → procedure?
> v : outputable/c
> procedure (cite v ...) → procedure?
> v : outputable/c
> procedure (abbr v ...) → procedure?
> v : outputable/c
> procedure (acronym v ...) → procedure?
> v : outputable/c
> procedure (q v ...) → procedure?
> v : outputable/c
> procedure (sub v ...) → procedure?
> v : outputable/c
> procedure (sup v ...) → procedure?
> v : outputable/c
> procedure (tt v ...) → procedure?
> v : outputable/c
> procedure (i v ...) → procedure?
> v : outputable/c
> procedure (b v ...) → procedure?
> v : outputable/c
> procedure (big v ...) → procedure?
> v : outputable/c
> procedure (small v ...) → procedure?
> v : outputable/c
> procedure (u v ...) → procedure?
> v : outputable/c
> procedure (s v ...) → procedure?
> v : outputable/c
> procedure (strike v ...) → procedure?
> v : outputable/c
> procedure (font v ...) → procedure?
> v : outputable/c
> procedure (object v ...) → procedure?
> v : outputable/c
> procedure (applet v ...) → procedure?
> v : outputable/c
> procedure (form v ...) → procedure?
> v : outputable/c
> procedure (label v ...) → procedure?
> v : outputable/c
> procedure (select v ...) → procedure?
> v : outputable/c
> procedure (optgroup v ...) → procedure?
> v : outputable/c
> procedure (option v ...) → procedure?
> v : outputable/c
> procedure (textarea v ...) → procedure?
> v : outputable/c
> procedure (fieldset v ...) → procedure?
> v : outputable/c
> procedure (legend v ...) → procedure?
> v : outputable/c
> procedure (button v ...) → procedure?
> v : outputable/c
> procedure (table v ...) → procedure?
> v : outputable/c
> procedure (caption v ...) → procedure?
> v : outputable/c
> procedure (thead v ...) → procedure?
> v : outputable/c
> procedure (tfoot v ...) → procedure?
> v : outputable/c
> procedure (tbody v ...) → procedure?
> v : outputable/c
> procedure (colgroup v ...) → procedure?
> v : outputable/c
> procedure (tr v ...) → procedure?
> v : outputable/c
> procedure (th v ...) → procedure?
> v : outputable/c
> procedure (td v ...) → procedure?
> v : outputable/c
> procedure (details v ...) → procedure?
> v : outputable/c
> procedure (dialog v ...) → procedure?
> v : outputable/c
> procedure (menuitem v ...) → procedure?
> v : outputable/c

Like element/not-empty, but with the symbolic form of the function name added as the first argument.

Example:

> > (output-xml (title "The Book"))
> <title>The Book</title>

> procedure (base v ...) → procedure?
> v : outputable/c
> procedure (meta v ...) → procedure?
> v : outputable/c
> procedure (link v ...) → procedure?
> v : outputable/c
> procedure (hr v ...) → procedure?
> v : outputable/c
> procedure (br v ...) → procedure?
> v : outputable/c
> procedure (basefont v ...) → procedure?
> v : outputable/c
> procedure (param v ...) → procedure?
> v : outputable/c
> procedure (img v ...) → procedure?
> v : outputable/c
> procedure (area v ...) → procedure?
> v : outputable/c
> procedure (input v ...) → procedure?
> v : outputable/c
> procedure (isindex v ...) → procedure?
> v : outputable/c
> procedure (col v ...) → procedure?
> v : outputable/c
> procedure (embed v ...) → procedure?
> v : outputable/c
> procedure (keygen v ...) → procedure?
> v : outputable/c
> procedure (wbr v ...) → procedure?
> v : outputable/c

Like element, but with the symbolic form of the function name added as the first argument.

Example:

> > (output-xml (hr))
> <hr />

> value nbsp : procedure?
> value ndash : procedure?
> value mdash : procedure?
> value bull : procedure?
> value middot : procedure?
> value sdot : procedure?
> value lsquo : procedure?
> value rsquo : procedure?
> value sbquo : procedure?
> value ldquo : procedure?
> value rdquo : procedure?
> value bdquo : procedure?
> value lang : procedure?
> value rang : procedure?
> value dagger : procedure?
> value Dagger : procedure?
> value plusmn : procedure?
> value deg : procedure?

The result of (entity 'id) for each id.

Example:

> > (output-xml nbsp)
> &nbsp;

> procedure (script/inline v ...) → procedure?
> v : outputable/c

Procedures a value that renders as an inline script.

Example:

> > (output-xml (script/inline type: "text/javascript" "var x = 5;"))
> <script type="text/javascript">
> //<![CDATA[
> var x = 5;
> //]]>
> </script>

> procedure (style/inline v ...) → procedure?
> v : outputable/c

Procedures a value that renders as an inline style sheet.

Example:

> > (output-xml (style/inline type: "text/css"
> ".racket { font-size: xx-large; }"))
> <style type="text/css">
> .racket { font-size: xx-large; }
> </style>

##### 2.1.1`` Other HTML elements

(require scribble/html/extra)
| package: scribble-html-lib

Provides renderers for HTML elements that are not provided by scribble/html/html.

> procedure (article v ...) → procedure?
> v : outputable/c
> procedure (aside v ...) → procedure?
> v : outputable/c
> procedure (audio v ...) → procedure?
> v : outputable/c
> procedure (bdi v ...) → procedure?
> v : outputable/c
> procedure (canvas v ...) → procedure?
> v : outputable/c
> procedure (data v ...) → procedure?
> v : outputable/c
> procedure (datalist v ...) → procedure?
> v : outputable/c
> procedure (figcaption v ...) → procedure?
> v : outputable/c
> procedure (figure v ...) → procedure?
> v : outputable/c
> procedure (footer v ...) → procedure?
> v : outputable/c
> procedure (header v ...) → procedure?
> v : outputable/c
> procedure (main v ...) → procedure?
> v : outputable/c
> procedure (map v ...) → procedure?
> v : outputable/c
> procedure (mark v ...) → procedure?
> v : outputable/c
> procedure (math v ...) → procedure?
> v : outputable/c
> procedure (meter v ...) → procedure?
> v : outputable/c
> procedure (nav v ...) → procedure?
> v : outputable/c
> procedure (output v ...) → procedure?
> v : outputable/c
> procedure (picture v ...) → procedure?
> v : outputable/c
> procedure (progress v ...) → procedure?
> v : outputable/c
> procedure (rb v ...) → procedure?
> v : outputable/c
> procedure (rp v ...) → procedure?
> v : outputable/c
> procedure (rt v ...) → procedure?
> v : outputable/c
> procedure (rtc v ...) → procedure?
> v : outputable/c
> procedure (ruby v ...) → procedure?
> v : outputable/c
> procedure (section v ...) → procedure?
> v : outputable/c
> procedure (summary v ...) → procedure?
> v : outputable/c
> procedure (svg v ...) → procedure?
> v : outputable/c
> procedure (template v ...) → procedure?
> v : outputable/c
> procedure (time v ...) → procedure?
> v : outputable/c
> procedure (video v ...) → procedure?
> v : outputable/c

Like element/not-empty, but with the symbolic form of the function name added as the first argument.

Example:

> > (output-xml (title "The Book"))
> <title>The Book</title>

> procedure (source v ...) → procedure?
> v : outputable/c
> procedure (track v ...) → procedure?
> v : outputable/c

Like element, but with the symbolic form of the function name added as the first argument.

Example:

> > (output-xml (hr))
> <hr />

top ← prev up next →