]> gitweb.factorcode.org Git - factor.git/commitdiff
help.html: use @2x images.
authorJohn Benediktsson <mrjbq7@gmail.com>
Wed, 20 May 2020 03:53:08 +0000 (20:53 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Wed, 20 May 2020 03:53:08 +0000 (20:53 -0700)
basis/help/html/html.factor
basis/help/html/stylesheet.css

index 5a2599c66824c11f9a3bd7f8b71eb052dda0c794..52afaae95a2a62ab0f7d5438a5999d547ce9d7f9 100644 (file)
@@ -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 <div id="container"><-><div class="page"><-></div></div> XML]
     ] bi simple-page ;
index 60a8edda26ce85337630588404c2538659836090..803af0c8f02d359b9f495736378e3cbb813fa780 100644 (file)
@@ -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;
+}