help.html: copy image resources to output directory.
This helps avoid needing so many different static responders in webapps.help, and makes the documentation more self-contained.master
parent
da8a378b38
commit
27215982e6
|
@ -143,25 +143,20 @@ M: pathname url-of
|
||||||
] [ drop ] if
|
] [ drop ] if
|
||||||
] each classes sort-values css-classes body ;
|
] each classes sort-values css-classes body ;
|
||||||
|
|
||||||
: img@2x ( body -- body' )
|
: retina-image ( path -- path' )
|
||||||
|
"@2x" over subseq? [ "." split1-last "@2x." glue ] unless ;
|
||||||
|
|
||||||
|
: ?copy-file ( from to -- )
|
||||||
|
dup exists? [ 2drop ] [ copy-file ] if ;
|
||||||
|
|
||||||
|
: cache-images ( body -- body' )
|
||||||
dup [
|
dup [
|
||||||
dup xml-chunk? [
|
dup xml-chunk? [
|
||||||
seq>> [
|
seq>> [
|
||||||
T{ name { main "img" } } over tag-named? [
|
T{ name { main "img" } } over tag-named? [
|
||||||
dup "src" attr
|
dup "src" attr
|
||||||
|
retina-image dup file-name
|
||||||
! use @2x retina images
|
[ ?copy-file ] keep
|
||||||
"@2x" over subseq? [
|
|
||||||
"." split1-last "@2x." glue
|
|
||||||
] unless
|
|
||||||
|
|
||||||
! src mapping for webapps.help
|
|
||||||
"vocab:definitions/icons/" ?head
|
|
||||||
[ "/icons/" prepend ] when
|
|
||||||
|
|
||||||
"vocab:ui/tools/error-list/icons/" ?head
|
|
||||||
[ "/icons2/" prepend ] when
|
|
||||||
|
|
||||||
"src" set-attr
|
"src" set-attr
|
||||||
] [ drop ] if
|
] [ drop ] if
|
||||||
] deep-each
|
] deep-each
|
||||||
|
@ -171,7 +166,8 @@ M: pathname url-of
|
||||||
: help>html ( topic -- xml )
|
: help>html ( topic -- xml )
|
||||||
[ article-title " - Factor Documentation" append ]
|
[ article-title " - Factor Documentation" append ]
|
||||||
[
|
[
|
||||||
[ print-topic ] with-html-writer css-styles-to-classes img@2x
|
[ print-topic ] with-html-writer
|
||||||
|
css-styles-to-classes cache-images
|
||||||
[ help-stylesheet help-meta prepend help-navbar ] dip
|
[ help-stylesheet help-meta prepend help-navbar ] dip
|
||||||
[XML <div id="container"><-><div class="page"><-></div></div> XML]
|
[XML <div id="container"><-><div class="page"><-></div></div> XML]
|
||||||
] bi simple-page ;
|
] bi simple-page ;
|
||||||
|
|
|
@ -39,9 +39,7 @@ TUPLE: help-webapp < dispatcher ;
|
||||||
help-webapp new-dispatcher
|
help-webapp new-dispatcher
|
||||||
<main-action> <secure-only> "" add-responder
|
<main-action> <secure-only> "" add-responder
|
||||||
help-dir <search-action> <secure-only> "search" add-responder
|
help-dir <search-action> <secure-only> "search" add-responder
|
||||||
help-dir <static> <secure-only> "content" add-responder
|
help-dir <static> <secure-only> "content" add-responder ;
|
||||||
"resource:basis/definitions/icons/" <static> <secure-only> "icons" add-responder
|
|
||||||
"resource:basis/ui/tools/error-list/icons/" <static> <secure-only> "icons2" add-responder ;
|
|
||||||
|
|
||||||
: run-help-webapp ( -- )
|
: run-help-webapp ( -- )
|
||||||
"docs" cache-file <help-webapp>
|
"docs" cache-file <help-webapp>
|
||||||
|
|
Loading…
Reference in New Issue