diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-11-02 10:23:04 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-11-02 10:23:04 -0700 |
commit | 6d00e6e8c3d483cc36afe2c065cdfdd4ef811f85 (patch) | |
tree | c0d6c6e9c0359c671a2882aa7944d9aacd16db5d /src/Text | |
parent | a553baf3a46e29d5137a8051838153c4fc83c6d5 (diff) | |
download | pandoc-6d00e6e8c3d483cc36afe2c065cdfdd4ef811f85.tar.gz |
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.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Writers/HTML.hs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index 9c5dfccf8..89cec38a2 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -655,7 +655,7 @@ blockToHtml opts (LineBlock lns) = return $ H.div ! A.class_ "line-block" $ htmlLines blockToHtml opts (Div attr@(ident, classes, kvs') bs) = do html5 <- gets stHtml5 - let kvs = kvs' ++ + let kvs = [(k,v) | (k,v) <- kvs', k /= "width"] ++ if "column" `elem` classes then let w = fromMaybe "48%" (lookup "width" kvs') in [("style", "width:" ++ w ++ ";min-width:" ++ w ++ @@ -664,7 +664,12 @@ blockToHtml opts (Div attr@(ident, classes, kvs') bs) = do let speakerNotes = "notes" `elem` classes -- we don't want incremental output inside speaker notes, see #1394 let opts' = if speakerNotes then opts{ writerIncremental = False } else opts - contents <- blockListToHtml opts' bs + contents <- if "columns" `elem` classes + then -- we don't use blockListToHtml because it inserts + -- a newline between the column divs, which throws + -- off widths! see #4028 + mconcat <$> mapM (blockToHtml opts) bs + else blockListToHtml opts' bs let contents' = nl opts >> contents >> nl opts let (divtag, classes') = if html5 && "section" `elem` classes then (H5.section, filter (/= "section") classes) |