diff --git a/basis/concurrency/messaging/messaging-docs.factor b/basis/concurrency/messaging/messaging-docs.factor
index 3bd2d330c3..41beedb6dc 100644
--- a/basis/concurrency/messaging/messaging-docs.factor
+++ b/basis/concurrency/messaging/messaging-docs.factor
@@ -53,7 +53,8 @@ ARTICLE: { "concurrency" "synchronous-sends" } "Synchronous sends"
{ $subsection reply-synchronous }
"An example:"
{ $example
- "USING: concurrency.messaging kernel threads ;"
+ "USING: concurrency.messaging kernel prettyprint threads ;"
+ "IN: scratchpad"
": pong-server ( -- )"
" receive [ \"pong\" ] dip reply-synchronous ;"
"[ pong-server t ] \"pong-server\" spawn-server"
diff --git a/basis/eval/eval-docs.factor b/basis/eval/eval-docs.factor
index 057d291b7f..b53c3bae6b 100644
--- a/basis/eval/eval-docs.factor
+++ b/basis/eval/eval-docs.factor
@@ -11,7 +11,7 @@ HELP: eval>string
{ $description "Evaluates the Factor code in " { $snippet "str" } " with " { $link output-stream } " rebound to a string output stream, then outputs the resulting string." } ;
ARTICLE: "eval" "Evaluating strings at runtime"
-"Evaluating strings at runtime:"
+"The " { $vocab-link "eval" } " vocabulary implements support for evaluating strings at runtime."
{ $subsection eval }
{ $subsection eval>string } ;
diff --git a/basis/eval/eval-tests.factor b/basis/eval/eval-tests.factor
new file mode 100644
index 0000000000..db4b95acdc
--- /dev/null
+++ b/basis/eval/eval-tests.factor
@@ -0,0 +1,4 @@
+IN: eval.tests
+USING: eval tools.test ;
+
+[ "4\n" ] [ "USING: math prettyprint ; 2 2 + ." eval>string ] unit-testv
\ No newline at end of file
diff --git a/basis/eval/eval.factor b/basis/eval/eval.factor
index 5b22fec159..dfa9baf418 100644
--- a/basis/eval/eval.factor
+++ b/basis/eval/eval.factor
@@ -1,14 +1,24 @@
-! Copyright (C) 2008 Slava Pestov.
+! Copyright (C) 2008, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: splitting parser compiler.units kernel namespaces
-debugger io.streams.string ;
+debugger io.streams.string fry ;
IN: eval
+: parse-string ( str -- )
+ [ string-lines parse-lines ] with-compilation-unit ;
+
+: (eval) ( str -- )
+ parse-string call ;
+
: eval ( str -- )
- [ string-lines parse-fresh ] with-compilation-unit call ;
+ [ (eval) ] with-file-vocabs ;
+
+: (eval>string) ( str -- output )
+ [
+ "quiet" on
+ parser-notes off
+ '[ _ (eval) ] try
+ ] with-string-writer ;
: eval>string ( str -- output )
- [
- parser-notes off
- [ [ eval ] keep ] try drop
- ] with-string-writer ;
+ [ (eval>string) ] with-file-vocabs ;
\ No newline at end of file
diff --git a/basis/farkup/farkup-tests.factor b/basis/farkup/farkup-tests.factor
index aa9345e1d0..ee09486a03 100644
--- a/basis/farkup/farkup-tests.factor
+++ b/basis/farkup/farkup-tests.factor
@@ -92,22 +92,22 @@ link-no-follow? off
[ "
=
foo
" ] [ "===foo==" convert-farkup ] unit-test
[ "foo
=
" ] [ "=foo==" convert-farkup ] unit-test
-[ "int main()\n
" ]
+[ "int main()
" ]
[ "[c{int main()}]" convert-farkup ] unit-test
-[ "
" ] [ "[[image:lol.jpg]]" convert-farkup ] unit-test
-[ "
" ] [ "[[image:lol.jpg|teh lol]]" convert-farkup ] unit-test
-[ "http://lol.com
" ] [ "[[http://lol.com]]" convert-farkup ] unit-test
-[ "haha
" ] [ "[[http://lol.com|haha]]" convert-farkup ] unit-test
-[ "Bar
" ] [ "[[Foo/Bar]]" convert-farkup ] unit-test
+[ "
" ] [ "[[image:lol.jpg]]" convert-farkup ] unit-test
+[ "
" ] [ "[[image:lol.jpg|teh lol]]" convert-farkup ] unit-test
+[ "http://lol.com
" ] [ "[[http://lol.com]]" convert-farkup ] unit-test
+[ "haha
" ] [ "[[http://lol.com|haha]]" convert-farkup ] unit-test
+[ "Bar
" ] [ "[[Foo/Bar]]" convert-farkup ] unit-test
"/wiki/view/" relative-link-prefix [
- [ "Bar
" ] [ "[[Foo/Bar]]" convert-farkup ] unit-test
+ [ "Bar
" ] [ "[[Foo/Bar]]" convert-farkup ] unit-test
] with-variable
[ ] [ "[{}]" convert-farkup drop ] unit-test
-[ "hello\n
" ] [ "[{hello}]" convert-farkup ] unit-test
+[ "hello
" ] [ "[{hello}]" convert-farkup ] unit-test
[
"Feature comparison:\n
a | Factor | Java | Lisp |
Coolness | Yes | No | No |
Badass | Yes | No | No |
Enterprise | Yes | Yes | No |
Kosher | Yes | No | Yes |
"
@@ -118,15 +118,15 @@ link-no-follow? off
] [ "Feature comparison:\n\n|a|Factor|Java|Lisp|\n|Coolness|Yes|No|No|\n|Badass|Yes|No|No|\n|Enterprise|Yes|Yes|No|\n|Kosher|Yes|No|Yes|\n" convert-farkup ] unit-test
[
- "This wiki is written in Factor and is hosted on a http://linode.com virtual server.
"
+ "This wiki is written in Factor and is hosted on a http://linode.com virtual server.
"
] [
"This wiki is written in [[Factor]] and is hosted on a [[http://linode.com|http://linode.com]] virtual server."
convert-farkup
] unit-test
-[ "a c
" ] [ "[[a]] [[b|c]]" convert-farkup ] unit-test
+[ "a c
" ] [ "[[a]] [[b|c]]" convert-farkup ] unit-test
-[ "C++
" ] [ "[[C++]]" convert-farkup ] unit-test
+[ "C++
" ] [ "[[C++]]" convert-farkup ] unit-test
[ "<foo>
" ] [ "" convert-farkup ] unit-test
@@ -138,10 +138,10 @@ link-no-follow? off
[ "
" ] [ "___" convert-farkup ] unit-test
[ "
\n" ] [ "___\n" convert-farkup ] unit-test
-[ "before:\n
{ 1 2 3 } 1 tail\n
" ]
+[ "before:\n
{ 1 2 3 } 1 tail
" ]
[ "before:\n[factor{{ 1 2 3 } 1 tail}]" convert-farkup ] unit-test
-[ "Factor-rific!
" ]
+[ "Factor-rific!
" ]
[ "[[Factor]]-rific!" convert-farkup ] unit-test
[ "[ factor { 1 2 3 }]
" ]
@@ -163,7 +163,7 @@ link-no-follow? off
convert-farkup string>xml-chunk
"a" deep-tag-named "href" swap at url-decode ;
-[ "Trader Joe's" ] [ "[[Trader Joe's]]" check-link-escaping ] unit-test
+[ "Trader Joe\"s" ] [ "[[Trader Joe\"s]]" check-link-escaping ] unit-test
[ "" ] [ "[[]]" check-link-escaping ] unit-test
[ "&blah;" ] [ "[[&blah;]]" check-link-escaping ] unit-test
-[ "C++" ] [ "[[C++]]" check-link-escaping ] unit-test
\ No newline at end of file
+[ "C++" ] [ "[[C++]]" check-link-escaping ] unit-test
diff --git a/basis/farkup/farkup.factor b/basis/farkup/farkup.factor
index 1bfd420dd3..ccd12b83f2 100644
--- a/basis/farkup/farkup.factor
+++ b/basis/farkup/farkup.factor
@@ -2,8 +2,9 @@
! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays combinators html.elements io
io.streams.string kernel math namespaces peg peg.ebnf
-sequences sequences.deep strings xml.entities
-vectors splitting xmode.code2html urls.encoding ;
+sequences sequences.deep strings xml.entities xml.interpolate
+vectors splitting xmode.code2html urls.encoding xml.data
+xml.writer ;
IN: farkup
SYMBOL: relative-link-prefix
@@ -74,6 +75,7 @@ inline-code = "%" (!("%" | nl).)+ "%"
=> [[ second >string inline-code boa ]]
link-content = (!("|"|"]").)+
+ => [[ >string ]]
image-link = "[[image:" link-content "|" link-content "]]"
=> [[ [ second >string ] [ fourth >string ] bi image boa ]]
@@ -146,7 +148,7 @@ named-code
simple-code
= "[{" (!("}]").)+ "}]"
- => [[ second f swap code boa ]]
+ => [[ second >string f swap code boa ]]
code = named-code | simple-code
@@ -163,66 +165,78 @@ stand-alone
{ [ dup [ 127 > ] contains? ] [ drop invalid-url ] }
{ [ dup first "/\\" member? ] [ drop invalid-url ] }
{ [ CHAR: : over member? ] [ dup absolute-url? [ drop invalid-url ] unless ] }
- [ relative-link-prefix get prepend ]
- } cond ;
+ [ relative-link-prefix get prepend "" like ]
+ } cond url-encode ;
-: escape-link ( href text -- href-esc text-esc )
- [ check-url ] dip escape-string ;
+: write-link ( href text -- xml )
+ [ check-url link-no-follow? get "true" and ] dip
+ [XML nofollow=<->><-> XML] ;
-: write-link ( href text -- )
- escape-link
- [ ]
- [ write ]
- bi* ;
-
-: write-image-link ( href text -- )
+: write-image-link ( href text -- xml )
disable-images? get [
2drop
- "Images are not allowed" write
+ [XML Images are not allowed XML]
] [
- escape-link
- [
] bi*
+ [ check-url ] [ f like ] bi*
+ [XML
alt=<->/> XML]
] if ;
-: render-code ( string mode -- string' )
- [ string-lines ] dip
- [
-
- htmlize-lines
-
- ] with-string-writer write ;
+: render-code ( string mode -- xml )
+ [ string-lines ] dip htmlize-lines
+ [XML <->
XML] ;
-GENERIC: (write-farkup) ( farkup -- )
-: ( string -- ) write ;
-: ( string -- ) write ;
-: in-tag. ( obj quot string -- ) [ call ] keep ; inline
-M: heading1 (write-farkup) [ child>> (write-farkup) ] "h1" in-tag. ;
-M: heading2 (write-farkup) [ child>> (write-farkup) ] "h2" in-tag. ;
-M: heading3 (write-farkup) [ child>> (write-farkup) ] "h3" in-tag. ;
-M: heading4 (write-farkup) [ child>> (write-farkup) ] "h4" in-tag. ;
-M: strong (write-farkup) [ child>> (write-farkup) ] "strong" in-tag. ;
-M: emphasis (write-farkup) [ child>> (write-farkup) ] "em" in-tag. ;
-M: superscript (write-farkup) [ child>> (write-farkup) ] "sup" in-tag. ;
-M: subscript (write-farkup) [ child>> (write-farkup) ] "sub" in-tag. ;
-M: inline-code (write-farkup) [ child>> (write-farkup) ] "code" in-tag. ;
-M: list-item (write-farkup) [ child>> (write-farkup) ] "li" in-tag. ;
-M: unordered-list (write-farkup) [ child>> (write-farkup) ] "ul" in-tag. ;
-M: ordered-list (write-farkup) [ child>> (write-farkup) ] "ol" in-tag. ;
-M: paragraph (write-farkup) [ child>> (write-farkup) ] "p" in-tag. ;
-M: link (write-farkup) [ href>> ] [ text>> ] bi write-link ;
-M: image (write-farkup) [ href>> ] [ text>> ] bi write-image-link ;
-M: code (write-farkup) [ string>> ] [ mode>> ] bi render-code ;
-M: line (write-farkup) drop
;
-M: line-break (write-farkup) drop
nl ;
-M: table-row (write-farkup) ( obj -- )
- child>> [ [ [ (write-farkup) ] "td" in-tag. ] each ] "tr" in-tag. ;
-M: table (write-farkup) [ child>> (write-farkup) ] "table" in-tag. ;
-M: string (write-farkup) escape-string write ;
-M: vector (write-farkup) [ (write-farkup) ] each ;
-M: f (write-farkup) drop ;
+GENERIC: (write-farkup) ( farkup -- xml )
-: write-farkup ( string -- )
+: farkup-inside ( farkup name -- xml )
+ swap T{ attrs } swap
+ child>> (write-farkup) 1array ;
+
+M: heading1 (write-farkup) "h1" farkup-inside ;
+M: heading2 (write-farkup) "h2" farkup-inside ;
+M: heading3 (write-farkup) "h3" farkup-inside ;
+M: heading4 (write-farkup) "h4" farkup-inside ;
+M: strong (write-farkup) "strong" farkup-inside ;
+M: emphasis (write-farkup) "em" farkup-inside ;
+M: superscript (write-farkup) "sup" farkup-inside ;
+M: subscript (write-farkup) "sub" farkup-inside ;
+M: inline-code (write-farkup) "code" farkup-inside ;
+M: list-item (write-farkup) "li" farkup-inside ;
+M: unordered-list (write-farkup) "ul" farkup-inside ;
+M: ordered-list (write-farkup) "ol" farkup-inside ;
+M: paragraph (write-farkup) "p" farkup-inside ;
+M: table (write-farkup) "table" farkup-inside ;
+
+M: link (write-farkup)
+ [ href>> ] [ text>> ] bi write-link ;
+
+M: image (write-farkup)
+ [ href>> ] [ text>> ] bi write-image-link ;
+
+M: code (write-farkup)
+ [ string>> ] [ mode>> ] bi render-code ;
+
+M: line (write-farkup)
+ drop [XML
XML] ;
+
+M: line-break (write-farkup)
+ drop [XML
XML] ;
+
+M: table-row (write-farkup)
+ child>>
+ [ (write-farkup) [XML <-> | XML] ] map
+ [XML <->
XML] ;
+
+M: string (write-farkup) ;
+
+M: vector (write-farkup) [ (write-farkup) ] map ;
+
+M: f (write-farkup) ;
+
+: farkup>xml ( string -- xml )
parse-farkup (write-farkup) ;
+: write-farkup ( string -- )
+ farkup>xml write-xml-chunk ;
+
: convert-farkup ( string -- string' )
- parse-farkup [ (write-farkup) ] with-string-writer ;
+ [ write-farkup ] with-string-writer ;
diff --git a/basis/help/lint/lint.factor b/basis/help/lint/lint.factor
index 2f61d05a61..30d5ef49df 100644
--- a/basis/help/lint/lint.factor
+++ b/basis/help/lint/lint.factor
@@ -1,4 +1,4 @@
-! Copyright (C) 2006, 2008 Slava Pestov.
+! Copyright (C) 2006, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: fry accessors sequences parser kernel help help.markup
help.topics words strings classes tools.vocabs namespaces make
@@ -6,21 +6,24 @@ io io.streams.string prettyprint definitions arrays vectors
combinators combinators.short-circuit splitting debugger
hashtables sorting effects vocabs vocabs.loader assocs editors
continuations classes.predicate macros math sets eval
-vocabs.parser words.symbol values ;
+vocabs.parser words.symbol values grouping unicode.categories
+sequences.deep ;
IN: help.lint
-: check-example ( element -- )
- rest [
- but-last "\n" join 1vector
- [
- use [ clone ] change
- [ eval>string ] with-datastack
- ] with-scope peek "\n" ?tail drop
- ] keep
- peek assert= ;
+SYMBOL: vocabs-quot
-: check-examples ( word element -- )
- nip \ $example swap elements [ check-example ] each ;
+: check-example ( element -- )
+ [
+ rest [
+ but-last "\n" join 1vector
+ [ (eval>string) ] with-datastack
+ peek "\n" ?tail drop
+ ] keep
+ peek assert=
+ ] vocabs-quot get call ;
+
+: check-examples ( element -- )
+ \ $example swap elements [ check-example ] each ;
: extract-values ( element -- seq )
\ $values swap elements dup empty? [
@@ -64,8 +67,13 @@ IN: help.lint
]
} 2|| [ "$values don't match stack effect" throw ] unless ;
-: check-see-also ( word element -- )
- nip \ $see-also swap elements [
+: check-nulls ( element -- )
+ \ $values swap elements
+ null swap deep-member?
+ [ "$values should not contain null" throw ] when ;
+
+: check-see-also ( element -- )
+ \ $see-also swap elements [
rest dup prune [ length ] bi@ assert=
] each ;
@@ -79,43 +87,78 @@ IN: help.lint
] each ;
: check-rendering ( element -- )
- [ print-topic ] with-string-writer drop ;
+ [ print-content ] with-string-writer drop ;
+
+: check-strings ( str -- )
+ [
+ "\n\t" intersects?
+ [ "Paragraph text should not contain \\n or \\t" throw ] when
+ ] [
+ " " swap subseq?
+ [ "Paragraph text should not contain double spaces" throw ] when
+ ] bi ;
+
+: check-whitespace ( str1 str2 -- )
+ [ " " tail? ] [ " " head? ] bi* or
+ [ "Missing whitespace between strings" throw ] unless ;
+
+: check-bogus-nl ( element -- )
+ { { $nl } { { $nl } } } [ head? ] with contains?
+ [ "Simple element should not begin with a paragraph break" throw ] when ;
+
+: check-elements ( element -- )
+ {
+ [ check-bogus-nl ]
+ [ [ string? ] filter [ check-strings ] each ]
+ [ [ simple-element? ] filter [ check-elements ] each ]
+ [ 2 [ [ string? ] all? ] filter [ first2 check-whitespace ] each ]
+ } cleave ;
+
+: check-markup ( element -- )
+ {
+ [ check-elements ]
+ [ check-rendering ]
+ [ check-examples ]
+ [ check-modules ]
+ } cleave ;
: all-word-help ( words -- seq )
[ word-help ] filter ;
-TUPLE: help-error topic error ;
+TUPLE: help-error error topic ;
C: help-error
M: help-error error.
- "In " write dup topic>> pprint nl
- error>> error. ;
+ [ "In " write topic>> pprint nl ]
+ [ error>> error. ]
+ bi ;
: check-something ( obj quot -- )
- flush [ , ] recover ; inline
+ flush '[ _ assert-depth ] swap '[ _ , ] recover ; inline
: check-word ( word -- )
+ [ with-file-vocabs ] vocabs-quot set
dup word-help [
- [
- dup word-help '[
- _ _ {
- [ check-examples ]
- [ check-values ]
- [ check-see-also ]
- [ [ check-rendering ] [ check-modules ] bi* ]
- } 2cleave
- ] assert-depth
+ dup '[
+ _ dup word-help
+ [ check-values ]
+ [ nip [ check-nulls ] [ check-see-also ] [ check-markup ] tri ] 2bi
] check-something
] [ drop ] if ;
: check-words ( words -- ) [ check-word ] each ;
+: check-article-title ( article -- )
+ article-title first LETTER?
+ [ "Article title must begin with a capital letter" throw ] unless ;
+
: check-article ( article -- )
- [
- dup article-content
- '[ _ check-rendering _ check-modules ]
- assert-depth
+ [ with-interactive-vocabs ] vocabs-quot set
+ dup '[
+ _
+ [ check-article-title ]
+ [ article-content check-markup ] bi
] check-something ;
: files>vocabs ( -- assoc )
@@ -135,7 +178,7 @@ M: help-error error.
] keep ;
: check-about ( vocab -- )
- [ vocab-help [ article drop ] when* ] check-something ;
+ dup '[ _ vocab-help [ article drop ] when* ] check-something ;
: check-vocab ( vocab -- seq )
"Checking " write dup write "..." print
diff --git a/basis/help/tutorial/tutorial.factor b/basis/help/tutorial/tutorial.factor
index 813eef4ea2..0a6765e10e 100644
--- a/basis/help/tutorial/tutorial.factor
+++ b/basis/help/tutorial/tutorial.factor
@@ -94,7 +94,7 @@ $nl
"For example, we'd like it to identify the following as a palindrome:"
{ $code "\"A man, a plan, a canal: Panama.\"" }
"However, right now, the simplistic algorithm we use says this is not a palindrome:"
-{ $example "\"A man, a plan, a canal: Panama.\" palindrome?" "f" }
+{ $unchecked-example "\"A man, a plan, a canal: Panama.\" palindrome?" "f" }
"We would like it to output " { $link t } " there. We can encode this requirement with a unit test that we add to " { $snippet "palindrome-tests.factor" } ":"
{ $code "[ t ] [ \"A man, a plan, a canal: Panama.\" palindrome? ] unit-test" }
"If you now run unit tests, you will see a unit test failure:"
@@ -106,12 +106,12 @@ $nl
"Start by pushing a character on the stack; notice that characters are really just integers:"
{ $code "CHAR: a" }
"Now, use the " { $link Letter? } " word to test if it is an alphabetical character, upper or lower case:"
-{ $example "Letter? ." "t" }
+{ $unchecked-example "Letter? ." "t" }
"This gives the expected result."
$nl
"Now try with a non-alphabetical character:"
{ $code "CHAR: #" }
-{ $example "Letter? ." "f" }
+{ $unchecked-example "Letter? ." "f" }
"What we want to do is given a string, remove all characters which do not match the " { $link Letter? } " predicate. Let's push a string on the stack:"
{ $code "\"A man, a plan, a canal: Panama.\"" }
"Now, place a quotation containing " { $link Letter? } " on the stack; quoting code places it on the stack instead of executing it immediately:"
diff --git a/basis/html/components/components-tests.factor b/basis/html/components/components-tests.factor
index b4247e6e30..09bb5860ad 100644
--- a/basis/html/components/components-tests.factor
+++ b/basis/html/components/components-tests.factor
@@ -31,7 +31,7 @@ TUPLE: color red green blue ;
] with-string-writer
] unit-test
-[ "" ] [
+[ "\" name=\"red\" type=\"hidden\"/>" ] [
[
"red" hidden render
] with-string-writer
@@ -39,13 +39,13 @@ TUPLE: color red green blue ;
[ ] [ "'jimmy'" "red" set-value ] unit-test
-[ "" ] [
+[ "" ] [
[
"red" 5 >>size render
] with-string-writer
] unit-test
-[ "" ] [
+[ "" ] [
[
"red" 5 >>size render
] with-string-writer
@@ -105,7 +105,7 @@ TUPLE: color red green blue ;
[ ] [ t "delivery" set-value ] unit-test
-[ "Delivery" ] [
+[ "Delivery" ] [
[
"delivery"
@@ -116,7 +116,7 @@ TUPLE: color red green blue ;
[ ] [ f "delivery" set-value ] unit-test
-[ "Delivery" ] [
+[ "Delivery" ] [
[
"delivery"
@@ -133,7 +133,7 @@ M: link-test link-href drop "http://www.apple.com/foo&bar" ;
[ ] [ link-test "link" set-value ] unit-test
-[ "<Link Title>" ] [
+[ "<Link Title>" ] [
[ "link" link new render ] with-string-writer
] unit-test
@@ -149,7 +149,7 @@ M: link-test link-href drop "http://www.apple.com/foo&bar" ;
[ ] [ "java" "mode" set-value ] unit-test
-[ "int x = 4;\n" ] [
+[ "int x = 4;" ] [
[ "code" "mode" >>mode render ] with-string-writer
] unit-test
@@ -163,6 +163,8 @@ M: link-test link-href drop "http://www.apple.com/foo&bar" ;
[ t ] [
[ "object" inspector render ] with-string-writer
+ USING: splitting sequences ;
+ "\"" split "'" join ! replace " with ' for now
[ "object" value [ describe ] with-html-writer ] with-string-writer
=
] unit-test
diff --git a/basis/html/components/components.factor b/basis/html/components/components.factor
index 6f35ba5d97..c8a4b20ca7 100644
--- a/basis/html/components/components.factor
+++ b/basis/html/components/components.factor
@@ -4,12 +4,12 @@ USING: accessors kernel namespaces io math.parser assocs classes
classes.tuple words arrays sequences splitting mirrors
hashtables combinators continuations math strings inspector
fry locals calendar calendar.format xml.entities
-validators urls present
-xmode.code2html lcs.diff2html farkup
+validators urls present xml.writer xml.interpolate xml
+xmode.code2html lcs.diff2html farkup io.streams.string
html.elements html.streams html.forms ;
IN: html.components
-GENERIC: render* ( value name renderer -- )
+GENERIC: render* ( value name renderer -- xml )
: render ( name renderer -- )
prepare-value
@@ -19,38 +19,36 @@ GENERIC: render* ( value name renderer -- )
[ f swap ]
if
] 2dip
- render*
+ render* write-xml-chunk
[ render-error ] when* ;
;
+: render-input ( value name type -- xml )
+ [XML name=<-> type=<->/> XML] ;
PRIVATE>
SINGLETON: label
-M: label render* 2drop present escape-string write ;
+M: label render*
+ 2drop present ;
SINGLETON: hidden
-M: hidden render* drop "hidden" render-input ;
+M: hidden render*
+ drop "hidden" render-input ;
-: render-field ( value name size type -- )
- ;
+: render-field ( value name size type -- xml )
+ [XML name=<-> size=<-> type=<->/> XML] ;
TUPLE: field size ;
: ( -- field )
field new ;
-M: field render* size>> "text" render-field ;
+M: field render*
+ size>> "text" render-field ;
TUPLE: password size ;
@@ -67,14 +65,12 @@ TUPLE: textarea rows cols ;
: