Fixing everything now(?)
parent
6372395b8a
commit
cadbcdc9a4
|
@ -144,7 +144,7 @@ SYMBOL: html
|
|||
</head>
|
||||
<body><-></body>
|
||||
</html>
|
||||
XML> write-xml ;
|
||||
XML> write-xml ; inline
|
||||
|
||||
: render-error ( message -- )
|
||||
[XML <span class="error"><-></span> XML] write-xml ;
|
||||
|
|
|
@ -49,7 +49,7 @@ DEFER: compile-element
|
|||
reset-buffer "@" ?head [ , [ value present ] % ] [ , ] if ;
|
||||
|
||||
: compile-attrs ( assoc -- )
|
||||
attrs>> [
|
||||
[
|
||||
" " [write]
|
||||
swap name>string [write]
|
||||
"=\"" [write]
|
||||
|
@ -59,7 +59,7 @@ DEFER: compile-element
|
|||
|
||||
: compile-start-tag ( tag -- )
|
||||
"<" [write]
|
||||
[ name>string [write] ] [ compile-attrs ] bi
|
||||
[ name>string [write] ] [ attrs>> compile-attrs ] bi
|
||||
">" [write] ;
|
||||
|
||||
: compile-end-tag ( tag -- )
|
||||
|
@ -126,7 +126,7 @@ ERROR: unknown-chloe-tag tag ;
|
|||
|
||||
: compile-prologue ( xml -- )
|
||||
[
|
||||
[ prolog>> [ write-prolog ] [code-with] ]
|
||||
[ prolog>> [ write-xml ] [code-with] ]
|
||||
[ before>> compile-chunk ]
|
||||
bi
|
||||
] compile-quot
|
||||
|
|
|
@ -2,7 +2,7 @@ USING: http http.server http.client http.client.private tools.test multiline
|
|||
io.streams.string io.encodings.utf8 io.encodings.8-bit
|
||||
io.encodings.binary io.encodings.string kernel arrays splitting
|
||||
sequences assocs io.sockets db db.sqlite continuations urls
|
||||
hashtables accessors namespaces ;
|
||||
hashtables accessors namespaces xml.data ;
|
||||
IN: http.tests
|
||||
|
||||
[ "text/plain" latin1 ] [ "text/plain" parse-content-type ] unit-test
|
||||
|
@ -322,7 +322,7 @@ SYMBOL: a
|
|||
|
||||
3 a set-global
|
||||
|
||||
: test-a string>xml "input" tag-named "value" swap at ;
|
||||
: test-a string>xml "input" tag-named "value" attr ;
|
||||
|
||||
[ "3" ] [
|
||||
"http://localhost/" add-port http-get
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
! Copyright (C) 2005, 2009 Daniel Ehrenberg
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: help.syntax help.markup io strings xml.data ;
|
||||
USING: help.syntax help.markup io strings xml.data multiline ;
|
||||
IN: xml.writer
|
||||
|
||||
ABOUT: "xml.writer"
|
||||
|
@ -39,3 +39,29 @@ HELP: pprint-xml
|
|||
|
||||
{ xml>string write-xml pprint-xml pprint-xml>string } related-words
|
||||
|
||||
HELP: indenter
|
||||
{ $var-description "Contains the string which is used for indenting in the XML prettyprinter. For example, to print an XML document using " { $snippet "%%%%" } " for indentation, you can use the following:" }
|
||||
{ $example {" USING: xml.interpolate xml.writer namespaces ;
|
||||
[XML <foo>bar</foo> XML] "%%%%" indenter [ pprint-xml ] with-variable "} {"
|
||||
<foo>
|
||||
%%%%bar
|
||||
</foo>"} } ;
|
||||
|
||||
HELP: sensitive-tags
|
||||
{ $var-description "Contains a sequence of " { $link name } "s where whitespace should be considered significant for prettyprinting purposes. The sequence can contain " { $link string } "s in place of names. For example, to preserve whitespace inside a " { $snippet "pre" } " tag:" }
|
||||
{ $example {" USING: xml.interpolate xml.writer namespaces ;
|
||||
[XML <html> <head> <title> something</title></head><body><pre>bing
|
||||
bang
|
||||
bong</pre></body></html> XML] { "pre" } sensitive-tags [ pprint-xml ] with-variable "} {"
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
something
|
||||
</title>
|
||||
</head>
|
||||
<body>
|
||||
<pre>bing
|
||||
bang
|
||||
bong</pre>
|
||||
</body>
|
||||
</html>"} } ;
|
||||
|
|
|
@ -61,7 +61,7 @@ PRIVATE>
|
|||
|
||||
PRIVATE>
|
||||
|
||||
GENERIC: write-xml ( object -- )
|
||||
GENERIC: write-xml ( xml -- )
|
||||
|
||||
<PRIVATE
|
||||
|
||||
|
@ -92,8 +92,8 @@ M: contained-tag write-xml
|
|||
M: open-tag write-xml
|
||||
xml-pprint? get [
|
||||
{
|
||||
[ sensitive? not xml-pprint? get and xml-pprint? set ]
|
||||
[ write-start-tag ]
|
||||
[ sensitive? not xml-pprint? get and xml-pprint? set ]
|
||||
[ write-children ]
|
||||
[ write-end-tag ]
|
||||
} cleave
|
||||
|
|
Loading…
Reference in New Issue