html.streams: move icon src mapping to help.html.

master
John Benediktsson 2020-05-21 17:19:36 -07:00
parent d2114e913c
commit 868d970784
3 changed files with 11 additions and 15 deletions

View File

@ -149,10 +149,17 @@ M: pathname url-of
seq>> [
T{ name { main "img" } } over tag-named? [
dup "src" attr
dup "@2x.png" tail? [ 2drop ] [
! use @2x retina images
dup "@2x.png" tail? [
"." split1-last "@2x." glue
] unless
! src mapping for webapps.help
"vocab:definitions/icons/" ?head
[ "/icons/" prepend ] when
"src" set-attr
] if
] [ drop ] if
] deep-each
] [ drop ] if

View File

@ -62,11 +62,3 @@ M: funky url-of "http://www.funky-town.com/" swap town>> append ;
] unit-test
{ } [ [ { 1 2 3 } describe ] with-html-writer drop ] unit-test
{ "<img src=\"/icons/class-word.tiff\"/>" } [
[
"text"
{ { image-style "vocab:definitions/icons/class-word.tiff" } }
format
] make-html-string
] unit-test

View File

@ -77,11 +77,8 @@ MACRO: make-css ( pairs -- str )
: emit-html ( stream quot -- )
dip data>> push ; inline
: icon-path ( path -- icons-path )
"vocab:definitions/icons/" ?head [ "/icons/" prepend ] when ;
: img-tag ( xml style -- xml )
image-style of [ nip icon-path simple-image ] when* ;
image-style of [ nip simple-image ] when* ;
: format-html-span ( string style stream -- )
[