From 334903bb9d7b7475666dcbb2c30b8d92339615a8 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 9 Nov 2022 16:30:40 -0800 Subject: HTML template: remove default font size, line height... ...and font family in default inline css. Closes #8423 (see comments there for motivation). `mainfont`, `fontsize`, and `linestretch` can still be used as before; the only difference is that we no longer provide opinionated defaults. This commit also adds a `maxwidth` variable that sets `max-width`; if not set, 36em is used as a default. --- MANUAL.txt | 3 +++ data/templates/styles.html | 16 +++++++++++----- test/lhs-test.html | 5 +---- test/lhs-test.html+lhs | 5 +---- test/writer.html4 | 5 +---- test/writer.html5 | 5 +---- 6 files changed, 18 insertions(+), 21 deletions(-) diff --git a/MANUAL.txt b/MANUAL.txt index 41a12df13..7a55cb29b 100644 --- a/MANUAL.txt +++ b/MANUAL.txt @@ -2641,6 +2641,9 @@ ODT or pptx. : sets the CSS `line-height` property on the `html` element, which is preferred to be unitless. +`maxwidth` +: sets the CSS `max-width` property (default is 32em). + `backgroundcolor` : sets the CSS `background-color` property on the `html` element. diff --git a/data/templates/styles.html b/data/templates/styles.html index c21f1acab..bee9911d3 100644 --- a/data/templates/styles.html +++ b/data/templates/styles.html @@ -1,14 +1,20 @@ $if(document-css)$ html { - line-height: $if(linestretch)$$linestretch$$else$1.5$endif$; - font-family: $if(mainfont)$$mainfont$$else$Georgia, serif$endif$; - font-size: $if(fontsize)$$fontsize$$else$20px$endif$; +$if(mainfont)$ + font-family: $mainfont$; +$endif$ +$if(fontsize)$ + font-size: $fontsize$; +$endif$ +$if(linestretch)$ + line-height: $linestretch$; +$endif$ color: $if(fontcolor)$$fontcolor$$else$#1a1a1a$endif$; background-color: $if(backgroundcolor)$$backgroundcolor$$else$#fdfdfd$endif$; } body { margin: 0 auto; - max-width: 36em; + max-width: $if(maxwidth)$$maxwidth$$else$36em$endif$; padding-left: $if(margin-left)$$margin-left$$else$50px$endif$; padding-right: $if(margin-right)$$margin-right$$else$50px$endif$; padding-top: $if(margin-top)$$margin-top$$else$50px$endif$; @@ -21,7 +27,7 @@ body { @media (max-width: 600px) { body { font-size: 0.9em; - padding: 1em; + padding: 12px; } h1 { font-size: 1.8em; diff --git a/test/lhs-test.html b/test/lhs-test.html index b8e5efca7..d1c1ae5e3 100644 --- a/test/lhs-test.html +++ b/test/lhs-test.html @@ -7,9 +7,6 @@ lhs-test