Move farkup, code, inspector components to html.components
parent
376c73c7c8
commit
53857fdfee
|
@ -1,6 +1,7 @@
|
|||
IN: html.components.tests
|
||||
USING: html.components tools.test kernel io.streams.string
|
||||
io.streams.null accessors ;
|
||||
USING: tools.test kernel io.streams.string
|
||||
io.streams.null accessors inspector html.streams
|
||||
html.components ;
|
||||
|
||||
[ ] [ blank-values ] unit-test
|
||||
|
||||
|
@ -145,3 +146,25 @@ M: link-test link-href drop "http://www.apple.com/foo&bar" ;
|
|||
[ "<html>arbitrary <b>markup</b> for the win!</html>" ] [
|
||||
[ "html" html render ] with-string-writer
|
||||
] unit-test
|
||||
|
||||
[ ] [ "int x = 4;" "code" set-value ] unit-test
|
||||
|
||||
[ ] [ "java" "mode" set-value ] unit-test
|
||||
|
||||
[ "<span class='KEYWORD3'>int</span> x <span class='OPERATOR'>=</span> <span class='DIGIT'>4</span>;\n" ] [
|
||||
[ "code" <code> "mode" >>mode render ] with-string-writer
|
||||
] unit-test
|
||||
|
||||
[ ] [ "-foo\n-bar" "farkup" set-value ] unit-test
|
||||
|
||||
[ "<ul><li>foo</li><li>bar</li></ul>" ] [
|
||||
[ "farkup" farkup render ] with-string-writer
|
||||
] unit-test
|
||||
|
||||
[ ] [ { 1 2 3 } "object" set-value ] unit-test
|
||||
|
||||
[ t ] [
|
||||
[ "object" inspector render ] with-string-writer
|
||||
[ "object" value [ describe ] with-html-stream ] with-string-writer
|
||||
=
|
||||
] unit-test
|
||||
|
|
|
@ -4,7 +4,7 @@ USING: accessors kernel namespaces io math.parser assocs classes
|
|||
classes.tuple words arrays sequences splitting mirrors
|
||||
hashtables combinators continuations math strings
|
||||
fry locals calendar calendar.format xml.entities validators
|
||||
html.elements ;
|
||||
html.elements html.streams xmode.code2html farkup inspector ;
|
||||
IN: html.components
|
||||
|
||||
SYMBOL: values
|
||||
|
@ -144,6 +144,27 @@ M: link render*
|
|||
link-title object>string escape-string write
|
||||
</a> ;
|
||||
|
||||
! XMode code component
|
||||
TUPLE: code mode ;
|
||||
|
||||
: <code> ( -- code )
|
||||
code new ;
|
||||
|
||||
M: code render*
|
||||
[ string-lines ] [ drop ] [ mode>> value ] tri* htmlize-lines ;
|
||||
|
||||
! Farkup component
|
||||
SINGLETON: farkup
|
||||
|
||||
M: farkup render*
|
||||
2drop string-lines "\n" join convert-farkup write ;
|
||||
|
||||
! Inspector component
|
||||
SINGLETON: inspector
|
||||
|
||||
M: inspector render*
|
||||
2drop [ describe ] with-html-stream ;
|
||||
|
||||
! HTML component
|
||||
SINGLETON: html
|
||||
|
||||
|
|
Loading…
Reference in New Issue