git.iko.soy/typeable/pandoc
on master help sign in
Fixed revealjs slide column width issues.

* Remove "width" attribute which is not allowed on div. * Remove space between `<div class="column">` elements, since this prevents columns whose widths sum to 100% (the space takes up space). Closes #4028.

commit6d00e6e8c3d483cc36afe2c065cdfdd4ef811f85 authorJohn MacFarlane <jgm@berkeley.edu> dateThu 2 Nov 2017, 10:23 (9 years ago) parenta553baf
2 files changed+10−7
src/Text/Pandoc/Writers/HTML.hs+7−2 test/command/1710.md+3−5
src/Text/Pandoc/Writers/HTML.hs+7−2
@@ -655,7 +655,7 @@ blockToHtml opts (LineBlock lns) =
655655 return $ H.div ! A.class_ "line-block" $ htmlLines
656656blockToHtml opts (Div attr@(ident, classes, kvs') bs) = do
657657 html5 <- gets stHtml5
658− let kvs = kvs' ++
658+ let kvs = [(k,v) | (k,v) <- kvs', k /= "width"] ++
659659 if "column" `elem` classes
660660 then let w = fromMaybe "48%" (lookup "width" kvs')
661661 in [("style", "width:" ++ w ++ ";min-width:" ++ w ++
@@ -664,7 +664,12 @@ blockToHtml opts (Div attr@(ident, classes, kvs') bs) = do
664664 let speakerNotes = "notes" `elem` classes
665665 -- we don't want incremental output inside speaker notes, see #1394
666666 let opts' = if speakerNotes then opts{ writerIncremental = False } else opts
667− contents <- blockListToHtml opts' bs
667+ contents <- if "columns" `elem` classes
668+ then -- we don't use blockListToHtml because it inserts
669+ -- a newline between the column divs, which throws
670+ -- off widths! see #4028
671+ mconcat <$> mapM (blockToHtml opts) bs
672+ else blockListToHtml opts' bs
668673 let contents' = nl opts >> contents >> nl opts
669674 let (divtag, classes') = if html5 && "section" `elem` classes
670675 then (H5.section, filter (/= "section") classes)
test/command/1710.md+3−5
@@ -19,19 +19,17 @@ ok
1919<section id="slide-one" class="slide level1">
2020<h1>Slide one</h1>
2121<div class="columns">
22−<div class="column" width="40%" style="width:40%;min-width:40%;vertical-align:top;">
22+<div class="column" style="width:40%;min-width:40%;vertical-align:top;">
2323<ul>
2424<li>a</li>
2525<li>b</li>
2626</ul>
27−</div>
28−<div class="column" width="40%" style="width:40%;min-width:40%;vertical-align:top;">
27+</div><div class="column" style="width:40%;min-width:40%;vertical-align:top;">
2928<ul>
3029<li>c</li>
3130<li>d</li>
3231</ul>
33−</div>
34−<div class="column" width="10%" style="width:10%;min-width:10%;vertical-align:top;">
32+</div><div class="column" style="width:10%;min-width:10%;vertical-align:top;">
3533<p>ok</p>
3634</div>
3735</div>