git.iko.soy/typeable/pandoc
on master help sign in
Improved support for columns in HTML.

* Move as much as possible to the CSS in the template. * Ensure that all the HTML-based templates (including epub) contain the CSS for columns. * Columns default to 50% width unless they are given a width attribute. Closes #4028.

commit642d603666521157d386e2a87bfdcca11d479b87 authorJohn MacFarlane <jgm@berkeley.edu> dateThu 2 Nov 2017, 20:55 (9 years ago) parent5282688
18 files changed+53−53
data/templates/default.dzslides+3−2 data/templates/default.epub2+3−2 data/templates/default.epub3+3−2 data/templates/default.html4+3−3 data/templates/default.html5+3−3 data/templates/default.revealjs+3−3 data/templates/default.s5+3−3 data/templates/default.slideous+3−3 data/templates/default.slidy+3−3 src/Text/Pandoc/Writers/HTML.hs+2−5 test/command/1710.md+3−3 test/lhs-test.html+3−3 test/lhs-test.html+lhs+3−3 test/s5-basic.html+3−3 test/s5-fancy.html+3−3 test/s5-inserts.html+3−3 test/writer.html4+3−3 test/writer.html5+3−3
data/templates/default.dzslides+3−2
@@ -14,8 +14,9 @@ $endif$
1414 <title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$</title>
1515 <style type="text/css">
1616 code{white-space: pre-wrap;}
17− .smallcaps{font-variant: small-caps;}
18− .column{display: inline-block;}
17+ span.smallcaps{font-variant: small-caps;}
18+ div.line-block{white-space: pre-line;}
19+ div.column{display: inline-block; vertical-align: top; width: 50%;}
1920$if(quotes)$
2021 q { quotes: "“" "”" "‘" "’"; }
2122$endif$
data/templates/default.epub2+3−2
@@ -8,8 +8,9 @@
88 <title>$pagetitle$</title>
99 <style type="text/css">
1010 code{white-space: pre-wrap;}
11− .smallcaps{font-variant: small-caps;}
12− .line-block{white-space: pre-line;}
11+ span.smallcaps{font-variant: small-caps;}
12+ div.line-block{white-space: pre-line;}
13+ div.column{display: inline-block; vertical-align: top; width: 50%;}
1314$if(quotes)$
1415 q { quotes: "“" "”" "‘" "’"; }
1516$endif$
data/templates/default.epub3+3−2
@@ -7,8 +7,9 @@
77 <title>$pagetitle$</title>
88 <style type="text/css">
99 code{white-space: pre-wrap;}
10− .smallcaps{font-variant: small-caps;}
11− .line-block{white-space: pre-line;}
10+ span.smallcaps{font-variant: small-caps;}
11+ div.line-block{white-space: pre-line;}
12+ div.column{display: inline-block; vertical-align: top; width: 50%;}
1213$if(quotes)$
1314 q { quotes: "“" "”" "‘" "’"; }
1415$endif$
data/templates/default.html4+3−3
@@ -16,9 +16,9 @@ $endif$
1616 <title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$</title>
1717 <style type="text/css">
1818 code{white-space: pre-wrap;}
19− .smallcaps{font-variant: small-caps;}
20− .line-block{white-space: pre-line;}
21− .column{display: inline-block;}
19+ span.smallcaps{font-variant: small-caps;}
20+ div.line-block{white-space: pre-line;}
21+ div.column{display: inline-block; vertical-align: top; width: 50%;}
2222$if(quotes)$
2323 q { quotes: "“" "”" "‘" "’"; }
2424$endif$
data/templates/default.html5+3−3
@@ -16,9 +16,9 @@ $endif$
1616 <title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$</title>
1717 <style type="text/css">
1818 code{white-space: pre-wrap;}
19− .smallcaps{font-variant: small-caps;}
20− .line-block{white-space: pre-line;}
21− .column{display: inline-block;}
19+ span.smallcaps{font-variant: small-caps;}
20+ div.line-block{white-space: pre-line;}
21+ div.column{display: inline-block; vertical-align: top; width: 50%;}
2222$if(quotes)$
2323 q { quotes: "“" "”" "‘" "’"; }
2424$endif$
data/templates/default.revealjs+3−3
@@ -19,9 +19,9 @@ $endif$
1919 <link rel="stylesheet" href="$revealjs-url$/css/reveal.css">
2020 <style type="text/css">
2121 code{white-space: pre-wrap;}
22− .smallcaps{font-variant: small-caps;}
23− .line-block{white-space: pre-line;}
24− .column{display: inline-block;}
22+ span.smallcaps{font-variant: small-caps;}
23+ div.line-block{white-space: pre-line;}
24+ div.column{display: inline-block; vertical-align: top; width: 50%;}
2525$if(quotes)$
2626 q { quotes: "“" "”" "‘" "’"; }
2727$endif$
data/templates/default.s5+3−3
@@ -17,9 +17,9 @@ $endif$
1717 <title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$</title>
1818 <style type="text/css">
1919 code{white-space: pre-wrap;}
20− .smallcaps{font-variant: small-caps;}
21− .line-block{white-space: pre-line;}
22− .column{display: inline-block;}
20+ span.smallcaps{font-variant: small-caps;}
21+ div.line-block{white-space: pre-line;}
22+ div.column{display: inline-block; vertical-align: top; width: 50%;}
2323$if(quotes)$
2424 q { quotes: "“" "”" "‘" "’"; }
2525$endif$
data/templates/default.slideous+3−3
@@ -18,9 +18,9 @@ $endif$
1818 <title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$</title>
1919 <style type="text/css">
2020 code{white-space: pre-wrap;}
21− .smallcaps{font-variant: small-caps;}
22− .line-block{white-space: pre-line;}
23− .column{display: inline-block;}
21+ span.smallcaps{font-variant: small-caps;}
22+ div.line-block{white-space: pre-line;}
23+ div.column{display: inline-block; vertical-align: top; width: 50%;}
2424$if(quotes)$
2525 q { quotes: "“" "”" "‘" "’"; }
2626$endif$
data/templates/default.slidy+3−3
@@ -18,9 +18,9 @@ $endif$
1818 <title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$</title>
1919 <style type="text/css">
2020 code{white-space: pre-wrap;}
21− .smallcaps{font-variant: small-caps;}
22− .line-block{white-space: pre-line;}
23− .column{display: inline-block;}
21+ span.smallcaps{font-variant: small-caps;}
22+ div.line-block{white-space: pre-line;}
23+ div.column{display: inline-block; vertical-align: top; width: 50%;}
2424$if(quotes)$
2525 q { quotes: "“" "”" "‘" "’"; }
2626$endif$
src/Text/Pandoc/Writers/HTML.hs+2−5
@@ -658,11 +658,8 @@ blockToHtml opts (LineBlock lns) =
658658blockToHtml opts (Div attr@(ident, classes, kvs') bs) = do
659659 html5 <- gets stHtml5
660660 let kvs = [(k,v) | (k,v) <- kvs', k /= "width"] ++
661− if "column" `elem` classes
662− then let w = fromMaybe "48%" (lookup "width" kvs')
663− in [("style", "width:" ++ w ++ ";min-width:" ++ w ++
664− ";vertical-align:top;")]
665− else []
661+ [("style", "width:" ++ w ++ ";")
662+ | ("width",w) <- kvs', "column" `elem` classes]
666663 let speakerNotes = "notes" `elem` classes
667664 -- we don't want incremental output inside speaker notes, see #1394
668665 let opts' = if speakerNotes then opts{ writerIncremental = False } else opts
test/command/1710.md+3−3
@@ -19,17 +19,17 @@ ok
1919<section id="slide-one" class="slide level1">
2020<h1>Slide one</h1>
2121<div class="columns">
22−<div class="column" style="width:40%;min-width:40%;vertical-align:top;">
22+<div class="column" style="width:40%;">
2323<ul>
2424<li>a</li>
2525<li>b</li>
2626</ul>
27−</div><div class="column" style="width:40%;min-width:40%;vertical-align:top;">
27+</div><div class="column" style="width:40%;">
2828<ul>
2929<li>c</li>
3030<li>d</li>
3131</ul>
32−</div><div class="column" style="width:10%;min-width:10%;vertical-align:top;">
32+</div><div class="column" style="width:10%;">
3333<p>ok</p>
3434</div>
3535</div>
test/lhs-test.html+3−3
@@ -7,9 +7,9 @@
77 <title>lhs-test</title>
88 <style type="text/css">
99 code{white-space: pre-wrap;}
10− .smallcaps{font-variant: small-caps;}
11− .line-block{white-space: pre-line;}
12− .column{display: inline-block;}
10+ span.smallcaps{font-variant: small-caps;}
11+ div.line-block{white-space: pre-line;}
12+ div.column{display: inline-block; vertical-align: top; width: 50%;}
1313 </style>
1414 <style type="text/css">
1515div.sourceLine, a.sourceLine { display: inline-block; min-height: 1.25em; }
test/lhs-test.html+lhs+3−3
@@ -7,9 +7,9 @@
77 <title>lhs-test</title>
88 <style type="text/css">
99 code{white-space: pre-wrap;}
10− .smallcaps{font-variant: small-caps;}
11− .line-block{white-space: pre-line;}
12− .column{display: inline-block;}
10+ span.smallcaps{font-variant: small-caps;}
11+ div.line-block{white-space: pre-line;}
12+ div.column{display: inline-block; vertical-align: top; width: 50%;}
1313 </style>
1414 <style type="text/css">
1515div.sourceLine, a.sourceLine { display: inline-block; min-height: 1.25em; }
test/s5-basic.html+3−3
@@ -12,9 +12,9 @@
1212 <title>My S5 Document</title>
1313 <style type="text/css">
1414 code{white-space: pre-wrap;}
15− .smallcaps{font-variant: small-caps;}
16− .line-block{white-space: pre-line;}
17− .column{display: inline-block;}
15+ span.smallcaps{font-variant: small-caps;}
16+ div.line-block{white-space: pre-line;}
17+ div.column{display: inline-block; vertical-align: top; width: 50%;}
1818 </style>
1919 <!-- configuration parameters -->
2020 <meta name="defaultView" content="slideshow" />
test/s5-fancy.html+3−3
@@ -12,9 +12,9 @@
1212 <title>My S5 Document</title>
1313 <style type="text/css">
1414 code{white-space: pre-wrap;}
15− .smallcaps{font-variant: small-caps;}
16− .line-block{white-space: pre-line;}
17− .column{display: inline-block;}
15+ span.smallcaps{font-variant: small-caps;}
16+ div.line-block{white-space: pre-line;}
17+ div.column{display: inline-block; vertical-align: top; width: 50%;}
1818 </style>
1919 <!-- configuration parameters -->
2020 <meta name="defaultView" content="slideshow" />
test/s5-inserts.html+3−3
@@ -10,9 +10,9 @@
1010 <title>My S5 Document</title>
1111 <style type="text/css">
1212 code{white-space: pre-wrap;}
13− .smallcaps{font-variant: small-caps;}
14− .line-block{white-space: pre-line;}
15− .column{display: inline-block;}
13+ span.smallcaps{font-variant: small-caps;}
14+ div.line-block{white-space: pre-line;}
15+ div.column{display: inline-block; vertical-align: top; width: 50%;}
1616 </style>
1717 <link rel="stylesheet" href="main.css" type="text/css" />
1818 STUFF INSERTED
test/writer.html4+3−3
@@ -10,9 +10,9 @@
1010 <title>Pandoc Test Suite</title>
1111 <style type="text/css">
1212 code{white-space: pre-wrap;}
13− .smallcaps{font-variant: small-caps;}
14− .line-block{white-space: pre-line;}
15− .column{display: inline-block;}
13+ span.smallcaps{font-variant: small-caps;}
14+ div.line-block{white-space: pre-line;}
15+ div.column{display: inline-block; vertical-align: top; width: 50%;}
1616 </style>
1717</head>
1818<body>
test/writer.html5+3−3
@@ -10,9 +10,9 @@
1010 <title>Pandoc Test Suite</title>
1111 <style type="text/css">
1212 code{white-space: pre-wrap;}
13− .smallcaps{font-variant: small-caps;}
14− .line-block{white-space: pre-line;}
15− .column{display: inline-block;}
13+ span.smallcaps{font-variant: small-caps;}
14+ div.line-block{white-space: pre-line;}
15+ div.column{display: inline-block; vertical-align: top; width: 50%;}
1616 </style>
1717 <!--[if lt IE 9]>
1818 <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>