git.iko.soy/typeable/pandoc
on master help sign in
Fixed revealjs slide column width issues.
6d00e6eJohn MacFarlane
src/Text/Pandoc/Writers/HTML.hs+7−2
@@ -655,7 +655,7 @@ blockToHtml opts (LineBlock lns) =
655 return $ H.div ! A.class_ "line-block" $ htmlLines
655 return $ H.div ! A.class_ "line-block" $ htmlLines
656blockToHtml opts (Div attr@(ident, classes, kvs') bs) = do
656blockToHtml opts (Div attr@(ident, classes, kvs') bs) = do
657 html5 <- gets stHtml5
657 html5 <- gets stHtml5
658− let kvs = kvs' ++
658+ let kvs = [(k,v) | (k,v) <- kvs', k /= "width"] ++
659 if "column" `elem` classes
659 if "column" `elem` classes
660 then let w = fromMaybe "48%" (lookup "width" kvs')
660 then let w = fromMaybe "48%" (lookup "width" kvs')
661 in [("style", "width:" ++ w ++ ";min-width:" ++ w ++
661 in [("style", "width:" ++ w ++ ";min-width:" ++ w ++
@@ -664,7 +664,12 @@ blockToHtml opts (Div attr@(ident, classes, kvs') bs) = do
664 let speakerNotes = "notes" `elem` classes
664 let speakerNotes = "notes" `elem` classes
665 -- we don't want incremental output inside speaker notes, see #1394
665 -- we don't want incremental output inside speaker notes, see #1394
666 let opts' = if speakerNotes then opts{ writerIncremental = False } else opts
666 let opts' = if speakerNotes then opts{ writerIncremental = False } else opts
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
667− contents <- blockListToHtml opts' bs
672+ else blockListToHtml opts' bs
668 let contents' = nl opts >> contents >> nl opts
673 let contents' = nl opts >> contents >> nl opts
669 let (divtag, classes') = if html5 && "section" `elem` classes
674 let (divtag, classes') = if html5 && "section" `elem` classes
670 then (H5.section, filter (/= "section") classes)
675 then (H5.section, filter (/= "section") classes)
test/command/1710.md+3−5
@@ -19,19 +19,17 @@ ok
19<section id="slide-one" class="slide level1">
19<section id="slide-one" class="slide level1">
20<h1>Slide one</h1>
20<h1>Slide one</h1>
21<div class="columns">
21<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;">
23<ul>
23<ul>
24<li>a</li>
24<li>a</li>
25<li>b</li>
25<li>b</li>
26</ul>
26</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;">
29<ul>
28<ul>
30<li>c</li>
29<li>c</li>
31<li>d</li>
30<li>d</li>
32</ul>
31</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;">
35<p>ok</p>
33<p>ok</p>
36</div>
34</div>
37</div>
35</div>