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
- "src" set-attr
- ] if
+ ] unless
+
+ ! src mapping for webapps.help
+ "vocab:definitions/icons/" ?head
+ [ "/icons/" prepend ] when
+
+ "src" set-attr
] [ drop ] if
] deep-each
] [ drop ] if
] 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
: 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 -- )
[