Fixing xml.interpolate docs

db4
Daniel Ehrenberg 2009-01-27 15:10:56 -06:00
parent c581b67193
commit 824df4182a
2 changed files with 11 additions and 8 deletions

View File

@ -23,10 +23,11 @@ ARTICLE: { "xml.interpolate" "in-depth" } "XML interpolation syntax"
$nl $nl
"These forms can be used where a tag might go, as in " { $snippet "[XML <foo><-></foo> XML]" } " or where an attribute might go, as in " { $snippet "[XML <foo bar=<->/> XML]" } ". When an attribute is spliced in, it is not included if the value is " { $snippet "f" } " and if the value is not a string, the value is put through " { $link present } ". Here is an example of the fry style of XML interpolation:" "These forms can be used where a tag might go, as in " { $snippet "[XML <foo><-></foo> XML]" } " or where an attribute might go, as in " { $snippet "[XML <foo bar=<->/> XML]" } ". When an attribute is spliced in, it is not included if the value is " { $snippet "f" } " and if the value is not a string, the value is put through " { $link present } ". Here is an example of the fry style of XML interpolation:"
{ $example { $example
{" "one two three" " " split {" USING: splitting sequences xml.writer xml.interpolate ;
"one two three" " " split
[ [XML <item><-></item> XML] ] map [ [XML <item><-></item> XML] ] map
<XML <doc><-></doc> XML> pprint-xml>string "} <XML <doc><-></doc> XML> pprint-xml"}
{" <' <?xml version="1.0" encoding="UTF-8"?> {" <?xml version="1.0" encoding="UTF-8"?>
<doc> <doc>
<item> <item>
one one
@ -37,10 +38,11 @@ $nl
<item> <item>
three three
</item> </item>
</doc>'> "} } </doc>"} }
"Here is an example of the locals version:" "Here is an example of the locals version:"
{ $example { $example
{" [let | {" USING: locals urls xml.interpolate xml.writer ;
[let |
number [ 3 ] number [ 3 ]
false [ f ] false [ f ]
url [ URL" http://factorcode.org/" ] url [ URL" http://factorcode.org/" ]
@ -53,6 +55,6 @@ $nl
url=<-url-> url=<-url->
string=<-string-> string=<-string->
word=<-word-> /> word=<-word-> />
XML> pprint-xml>string ] "} XML> pprint-xml ] "}
{" <' <?xml version="1.0" encoding="UTF-8"?> {" <?xml version="1.0" encoding="UTF-8"?>
<x number="3" url="http://factorcode.org/" string="hello" word="drop"/>'> "} } ; <x number="3" url="http://factorcode.org/" string="hello" word="drop"/>"} } ;

View File

@ -56,3 +56,4 @@ IN: xml.interpolate.tests
\ parse-def must-infer \ parse-def must-infer
[ "" interpolate-chunk ] must-infer [ "" interpolate-chunk ] must-infer
[ [XML <foo><-></foo> <bar val=<->/> XML] ] must-infer