1 USING: html.streams html.streams.private accessors io
2 io.streams.string io.styles kernel namespaces tools.test
3 sbufs sequences inspector colors xml.writer
4 classes.predicate prettyprint ;
7 : make-html-string ( quot -- string )
8 [ with-html-writer write-xml ] with-string-writer ; inline
10 [ [ ] make-html-string ] must-infer
13 [ "" write ] make-html-string
17 [ CHAR: a write1 ] make-html-string
21 [ "<" write ] make-html-string
26 M: funky url-of "http://www.funky-town.com/" swap town>> append ;
28 [ "<a href=\"http://www.funky-town.com/austin\"><</a>" ] [
30 "<" "austin" funky boa write-object
34 [ "<span style=\"font-family: monospace; \">car</span>" ]
38 H{ { font-name "monospace" } }
43 [ "<span style=\"color: #ff00ff; \">car</span>" ]
47 H{ { foreground T{ rgba f 1 0 1 1 } } }
52 [ "<div style=\"background-color: #ff00ff; white-space: pre; font-family: monospace;\">cdr</div>" ]
55 H{ { page-color T{ rgba f 1 0 1 1 } } }
56 [ "cdr" write ] with-nesting
60 [ "<div style=\"white-space: pre; font-family: monospace;\"></div>" ] [
61 [ H{ } [ ] with-nesting nl ] make-html-string
64 [ ] [ [ { 1 2 3 } describe ] with-html-writer drop ] unit-test
66 [ "<img src=\"/icons/class-word.tiff\"/>" ] [
69 { { image "vocab:definitions/icons/class-word.tiff" } }