From e28bcd400bc6c7ebe89a461d7285e0f9ffd14398 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Tue, 19 May 2020 20:53:08 -0700 Subject: [PATCH] help.html: use @2x images. --- basis/help/html/html.factor | 20 ++++++++++++++++++-- basis/help/html/stylesheet.css | 7 +++++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/basis/help/html/html.factor b/basis/help/html/html.factor index 5a2599c668..52afaae95a 100644 --- a/basis/help/html/html.factor +++ b/basis/help/html/html.factor @@ -6,7 +6,8 @@ html html.streams io.directories io.encodings.binary io.encodings.utf8 io.files io.files.temp io.pathnames kernel locals make math math.parser memoize namespaces regexp sequences sequences.deep serialize sorting splitting tools.completion -vocabs vocabs.hierarchy words xml.data xml.syntax xml.writer ; +vocabs vocabs.hierarchy words xml.data xml.syntax xml.traversal +xml.writer ; FROM: io.encodings.ascii => ascii ; FROM: ascii => ascii? ; IN: help.html @@ -142,10 +143,25 @@ M: pathname url-of ] [ drop ] if ] each classes sort-values css-classes body ; +: img@2x ( body -- body' ) + dup [ + dup xml-chunk? [ + seq>> [ + T{ name { main "img" } } over tag-named? [ + dup "src" attr + dup "@2x.png" tail? [ 2drop ] [ + "." split1-last "@2x." glue + "src" set-attr + ] if + ] [ drop ] if + ] deep-each + ] [ drop ] if + ] each ; + : help>html ( topic -- xml ) [ article-title " - Factor Documentation" append ] [ - [ print-topic ] with-html-writer css-styles-to-classes + [ print-topic ] with-html-writer css-styles-to-classes img@2x [ help-stylesheet help-meta prepend help-navbar ] dip [XML
<->
<->
XML] ] bi simple-page ; diff --git a/basis/help/html/stylesheet.css b/basis/help/html/stylesheet.css index 60a8edda26..803af0c8f0 100644 --- a/basis/help/html/stylesheet.css +++ b/basis/help/html/stylesheet.css @@ -24,8 +24,6 @@ input { img { vertical-align: middle; - width: 16px; - height: 16px; } table { @@ -59,3 +57,8 @@ tr:hover { .page { margin: 15px; } + +.page img { + width: 16px; + height: 16px; +}