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

@ -1,4 +1,4 @@
IN: eval.tests
USING: eval tools.test ;
[ "4\n" ] [ "USING: math prettyprint ; 2 2 + ." eval>string ] unit-test
[ "4\n" ] [ "USING: math prettyprint ; 2 2 + ." eval>string ] unit-test

View File

@ -3,7 +3,7 @@
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
fry locals calendar calendar.format xml.entities xml.data
validators urls present xml.writer xml.interpolate xml
xmode.code2html lcs.diff2html farkup io.streams.string
html.elements html.streams html.forms ;
@ -65,12 +65,15 @@ TUPLE: textarea rows cols ;
: <textarea> ( -- renderer )
textarea new ;
M: textarea render* ( value name area -- xml )
rot [ [ rows>> ] [ cols>> ] bi ] dip
[XML <textarea
name=<->
rows=<->
cols=<->><-></textarea> XML] ;
M:: textarea render* ( value name area -- xml )
area rows>> :> rows
area cols>> :> cols
[XML
<textarea
name=<-name->
rows=<-rows->
cols=<-cols->><-value-></textarea>
XML] ;
! Choice
TUPLE: choice size multiple choices ;
@ -160,8 +163,9 @@ M: farkup render*
SINGLETON: inspector
M: inspector render*
2drop [ [ describe ] with-html-writer ] with-string-writer
string>xml-chunk ;
2drop [
[ describe ] with-html-writer
] with-string-writer <unescaped> ;
! Diff component
SINGLETON: comparison

View File

@ -219,3 +219,6 @@ PREDICATE: open-tag < tag children>> ;
UNION: xml-data
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
[ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<foo>\n bar\n</foo>" ]
[ "<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
] dip xml-pprint? set ;
M: unescaped write-xml-chunk
string>> write ;
M: comment write-xml-chunk
"<!--" write text>> write "-->" write ;

View File

@ -15,7 +15,7 @@ IN: xmode.code2html
tokenize-line htmlize-tokens ;
: 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 )
"resource:basis/xmode/code2html/stylesheet.css"