Merge branch 'master' of git://factorcode.org/git/factor

db4
Slava Pestov 2009-01-28 12:16:21 -06:00
commit 5c15d436a9
6 changed files with 22 additions and 11 deletions

View File

@ -3,7 +3,7 @@
USING: accessors kernel namespaces io math.parser assocs classes USING: accessors kernel namespaces io math.parser assocs classes
classes.tuple words arrays sequences splitting mirrors classes.tuple words arrays sequences splitting mirrors
hashtables combinators continuations math strings inspector hashtables combinators continuations math strings inspector
fry locals calendar calendar.format xml.entities fry locals calendar calendar.format xml.entities xml.data
validators urls present xml.writer xml.interpolate xml validators urls present xml.writer xml.interpolate xml
xmode.code2html lcs.diff2html farkup io.streams.string xmode.code2html lcs.diff2html farkup io.streams.string
html.elements html.streams html.forms ; html.elements html.streams html.forms ;
@ -65,12 +65,15 @@ TUPLE: textarea rows cols ;
: <textarea> ( -- renderer ) : <textarea> ( -- renderer )
textarea new ; textarea new ;
M: textarea render* ( value name area -- xml ) M:: textarea render* ( value name area -- xml )
rot [ [ rows>> ] [ cols>> ] bi ] dip area rows>> :> rows
[XML <textarea area cols>> :> cols
name=<-> [XML
rows=<-> <textarea
cols=<->><-></textarea> XML] ; name=<-name->
rows=<-rows->
cols=<-cols->><-value-></textarea>
XML] ;
! Choice ! Choice
TUPLE: choice size multiple choices ; TUPLE: choice size multiple choices ;
@ -160,8 +163,9 @@ M: farkup render*
SINGLETON: inspector SINGLETON: inspector
M: inspector render* M: inspector render*
2drop [ [ describe ] with-html-writer ] with-string-writer 2drop [
string>xml-chunk ; [ describe ] with-html-writer
] with-string-writer <unescaped> ;
! Diff component ! Diff component
SINGLETON: comparison SINGLETON: comparison

View File

@ -219,3 +219,6 @@ PREDICATE: open-tag < tag children>> ;
UNION: xml-data UNION: xml-data
tag comment string directive instruction ; tag comment string directive instruction ;
TUPLE: unescaped string ;
C: <unescaped> unescaped

View File

@ -59,3 +59,4 @@ IN: xml.writer.tests
[ "<foo>bar</foo>" string>xml [ " baz" append ] map xml>string ] unit-test [ "<foo>bar</foo>" string>xml [ " baz" append ] map xml>string ] unit-test
[ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<foo>\n bar\n</foo>" ] [ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<foo>\n bar\n</foo>" ]
[ "<foo> bar </foo>" string>xml pprint-xml>string ] unit-test [ "<foo> bar </foo>" string>xml pprint-xml>string ] unit-test
[ "<foo'>" ] [ "<foo'>" <unescaped> xml-chunk>string ] unit-test

View File

@ -98,6 +98,9 @@ M: open-tag write-xml-chunk
} cleave } cleave
] dip xml-pprint? set ; ] dip xml-pprint? set ;
M: unescaped write-xml-chunk
string>> write ;
M: comment write-xml-chunk M: comment write-xml-chunk
"<!--" write text>> write "-->" write ; "<!--" write text>> write "-->" write ;

View File

@ -15,7 +15,7 @@ IN: xmode.code2html
tokenize-line htmlize-tokens ; tokenize-line htmlize-tokens ;
: htmlize-lines ( lines mode -- xml ) : htmlize-lines ( lines mode -- xml )
f -rot load-mode [ htmlize-line ] curry map nip ; [ f ] 2dip load-mode [ htmlize-line ] curry map nip ;
: default-stylesheet ( -- xml ) : default-stylesheet ( -- xml )
"resource:basis/xmode/code2html/stylesheet.css" "resource:basis/xmode/code2html/stylesheet.css"