Skip to content

Commit 2b5600f

Browse files
authored
HTML styles: make screen-only CSS conditional (#11606)
Styles unconditionally emits css that uses screen-only properties. Paged-media engines (weasyprint, prince, pagedjs) have no viewport and issue warnings. Fix it to hide these properties from the engines. Closes #11524.
1 parent 672e745 commit 2b5600f

6 files changed

Lines changed: 36 additions & 12 deletions

File tree

data/templates/styles.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,12 @@
185185
}
186186
$endif$
187187
span.smallcaps{font-variant: small-caps;}
188-
div.columns{display: flex; gap: min(4vw, 1.5em);}
189-
div.column{flex: auto; overflow-x: auto;}
188+
div.columns{display: flex; gap: 1.5em;}
189+
div.column{flex: auto;}
190+
@media screen {
191+
div.columns{gap: min(4vw, 1.5em);}
192+
div.column{overflow-x: auto;}
193+
}
190194
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
191195
/* The extra [class] is a hack that increases specificity enough to
192196
override a similar rule in reveal.js */

test/s5-basic.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@
1515
** See https://pandoc.org/MANUAL.html#variables-for-html for config info.
1616
*/
1717
span.smallcaps{font-variant: small-caps;}
18-
div.columns{display: flex; gap: min(4vw, 1.5em);}
19-
div.column{flex: auto; overflow-x: auto;}
18+
div.columns{display: flex; gap: 1.5em;}
19+
div.column{flex: auto;}
20+
@media screen {
21+
div.columns{gap: min(4vw, 1.5em);}
22+
div.column{overflow-x: auto;}
23+
}
2024
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
2125
/* The extra [class] is a hack that increases specificity enough to
2226
override a similar rule in reveal.js */

test/s5-fancy.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@
1515
** See https://pandoc.org/MANUAL.html#variables-for-html for config info.
1616
*/
1717
span.smallcaps{font-variant: small-caps;}
18-
div.columns{display: flex; gap: min(4vw, 1.5em);}
19-
div.column{flex: auto; overflow-x: auto;}
18+
div.columns{display: flex; gap: 1.5em;}
19+
div.column{flex: auto;}
20+
@media screen {
21+
div.columns{gap: min(4vw, 1.5em);}
22+
div.column{overflow-x: auto;}
23+
}
2024
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
2125
/* The extra [class] is a hack that increases specificity enough to
2226
override a similar rule in reveal.js */

test/s5-inserts.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@
1313
** See https://pandoc.org/MANUAL.html#variables-for-html for config info.
1414
*/
1515
span.smallcaps{font-variant: small-caps;}
16-
div.columns{display: flex; gap: min(4vw, 1.5em);}
17-
div.column{flex: auto; overflow-x: auto;}
16+
div.columns{display: flex; gap: 1.5em;}
17+
div.column{flex: auto;}
18+
@media screen {
19+
div.columns{gap: min(4vw, 1.5em);}
20+
div.column{overflow-x: auto;}
21+
}
1822
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
1923
/* The extra [class] is a hack that increases specificity enough to
2024
override a similar rule in reveal.js */

test/writer.html4

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,12 @@
159159
text-decoration: none;
160160
}
161161
span.smallcaps{font-variant: small-caps;}
162-
div.columns{display: flex; gap: min(4vw, 1.5em);}
163-
div.column{flex: auto; overflow-x: auto;}
162+
div.columns{display: flex; gap: 1.5em;}
163+
div.column{flex: auto;}
164+
@media screen {
165+
div.columns{gap: min(4vw, 1.5em);}
166+
div.column{overflow-x: auto;}
167+
}
164168
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
165169
/* The extra [class] is a hack that increases specificity enough to
166170
override a similar rule in reveal.js */

test/writer.html5

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,12 @@
159159
text-decoration: none;
160160
}
161161
span.smallcaps{font-variant: small-caps;}
162-
div.columns{display: flex; gap: min(4vw, 1.5em);}
163-
div.column{flex: auto; overflow-x: auto;}
162+
div.columns{display: flex; gap: 1.5em;}
163+
div.column{flex: auto;}
164+
@media screen {
165+
div.columns{gap: min(4vw, 1.5em);}
166+
div.column{overflow-x: auto;}
167+
}
164168
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
165169
/* The extra [class] is a hack that increases specificity enough to
166170
override a similar rule in reveal.js */

0 commit comments

Comments
 (0)