html.streams: change how images work; webapps.help: support definition icons
parent
0836e79e66
commit
835cd68284
|
@ -61,4 +61,12 @@ M: funky url-of "http://www.funky-town.com/" swap town>> append ;
|
||||||
[ H{ } [ ] with-nesting nl ] make-html-string
|
[ H{ } [ ] with-nesting nl ] make-html-string
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
[ ] [ [ { 1 2 3 } describe ] with-html-writer drop ] unit-test
|
[ ] [ [ { 1 2 3 } describe ] with-html-writer drop ] unit-test
|
||||||
|
|
||||||
|
[ "<img src=\"/icons/class-word.tiff\"/>" ] [
|
||||||
|
[
|
||||||
|
"text"
|
||||||
|
{ { image "vocab:definitions/icons/class-word.tiff" } }
|
||||||
|
format
|
||||||
|
] make-html-string
|
||||||
|
] unit-test
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors assocs combinators destructors fry html io
|
USING: accessors assocs combinators destructors fry html io
|
||||||
io.backend io.pathnames io.styles kernel macros make math
|
io.backend io.pathnames io.styles kernel macros make math
|
||||||
math.order math.parser namespaces sequences strings words xml
|
math.order math.parser namespaces sequences strings words
|
||||||
xml.syntax ;
|
splitting xml xml.syntax ;
|
||||||
IN: html.streams
|
IN: html.streams
|
||||||
|
|
||||||
GENERIC: url-of ( object -- url )
|
GENERIC: url-of ( object -- url )
|
||||||
|
@ -88,12 +88,11 @@ MACRO: make-css ( pairs -- str )
|
||||||
: emit-html ( quot stream -- )
|
: emit-html ( quot stream -- )
|
||||||
dip data>> push ; inline
|
dip data>> push ; inline
|
||||||
|
|
||||||
: image-resource-path ( path -- images-path )
|
: image-path ( path -- images-path )
|
||||||
normalize-path current-directory get drop-prefix drop
|
"vocab:definitions/icons/" ?head [ "/icons/" prepend ] when ;
|
||||||
"/images" prepend ;
|
|
||||||
|
|
||||||
: img-tag ( xml style -- xml )
|
: img-tag ( xml style -- xml )
|
||||||
image swap at [ nip image-resource-path simple-image ] when* ;
|
image swap at [ nip image-path simple-image ] when* ;
|
||||||
|
|
||||||
: format-html-span ( string style stream -- )
|
: format-html-span ( string style stream -- )
|
||||||
[
|
[
|
||||||
|
|
|
@ -38,6 +38,7 @@ M: result link-href href>> ;
|
||||||
help-webapp new-dispatcher
|
help-webapp new-dispatcher
|
||||||
<main-action> "" add-responder
|
<main-action> "" add-responder
|
||||||
over <search-action> "search" add-responder
|
over <search-action> "search" add-responder
|
||||||
swap <static> "content" add-responder ;
|
swap <static> "content" add-responder
|
||||||
|
"resource:basis/definitions/icons/" <static> "icons" add-responder ;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue