]> gitweb.factorcode.org Git - factor.git/commitdiff
help.html: some style fixes
authorJohn Benediktsson <mrjbq7@gmail.com>
Tue, 31 Jan 2023 06:09:58 +0000 (22:09 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Tue, 31 Jan 2023 06:10:14 +0000 (22:10 -0800)
basis/help/html/html.factor
basis/help/html/stylesheet.css

index a9b7aac1bd903a06bb9372ddd75b645f90bc6313..012b6ead688016d78f01a368b1fd7078a8ffafef 100644 (file)
@@ -169,11 +169,11 @@ M: pathname url-of
     ] re-replace-with
 
     R/ font-family: monospace;/ [
-        " white-space: pre-wrap; line-height: 125%;" append
+        " width: fit-content; white-space: pre-wrap; line-height: 125%;" append
     ] re-replace-with
 
     dup { "font-family: monospace;" "background-color:" } [ subseq-of? ] with all? [
-        " margin: 10px 0px;" append
+        " margin: 1.0rem 0;" append
     ] when
 
     dup { "border:" "background-color:" } [ subseq-of? ] with all? [
@@ -277,8 +277,22 @@ M: pathname url-of
         [XML <-><div class="page"><-><-></div> XML]
     ] bi simple-page ;
 
+: fix-spacing ( html -- html' )
+    ! one line spacing before/after divs
+    "div><br/><br/><" "div><br/><" replace
+    "><br/><br/><div" "><br/><div" replace
+
+    ! one line spacing before after tables
+    "table><br/><br/><" "table><br/><" replace
+    "><br/><br/><table" "><br/><table" replace
+
+    ! spans before or after divs don't need line breaks
+    "span><br/><div" "span><div" replace
+    "div><br/><span" "div><span" replace ;
+
 : generate-help-file ( topic -- )
-    dup topic>filename utf8 [ help>html write-xml ] with-file-writer ;
+    [ help>html xml>string fix-spacing ]
+    [ topic>filename utf8 set-file-contents ] bi ;
 
 : all-vocabs-really ( -- seq )
     all-disk-vocabs-recursive filter-vocabs
index e2ebeec45829b260295eb6c4375305c3cae19973..20f7d0007c1024f4f3d100798f5e79aa8fa6c373 100644 (file)
@@ -130,3 +130,9 @@ footer {
         background-color: #373e48;
     }
 }
+
+@media print {
+    body {
+        font-size: 10pt;
+    }
+}