Merge branch 'master' into new_ui

db4
Slava Pestov 2009-01-28 12:17:00 -06:00
commit a310d67291
7 changed files with 23 additions and 12 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"

View File

@ -557,7 +557,7 @@ HELP: GENERIC:
HELP: GENERIC#
{ $syntax "GENERIC# word n" }
{ $values { "word" "a new word to define" } { "n" "the stack position to dispatch on, either 0, 1 or 2" } }
{ $values { "word" "a new word to define" } { "n" "the stack position to dispatch on" } }
{ $description "Defines a new generic word which dispatches on the " { $snippet "n" } "th most element from the top of the stack in the current vocabulary. Initially, it contains no methods, and thus will throw a " { $link no-method } " error when called." }
{ $notes
"The following two definitions are equivalent:"