aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2013-10-13 15:36:19 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2013-10-13 15:37:25 -0700
commit0df7cce37da162c656aa88ecb67788109749668c (patch)
treeaefb6866aa3a6dedd00fbd3511ffbd210efa4c6b /src
parent2ae7f5e2a0a741fa4822448ad378280f77ab0dd5 (diff)
downloadpandoc-0df7cce37da162c656aa88ecb67788109749668c.tar.gz
Treat div with class "notes" as speaker notes in slide formats.
Currently beamer goes to `\note{}`, revealjs to `<aside class="notes">`, and the notes are simply suppressed in other formats. Closes #925.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/HTML.hs11
-rw-r--r--src/Text/Pandoc/Writers/LaTeX.hs7
2 files changed, 15 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs
index cee07cff5..22f5b8074 100644
--- a/src/Text/Pandoc/Writers/HTML.hs
+++ b/src/Text/Pandoc/Writers/HTML.hs
@@ -421,9 +421,16 @@ blockToHtml opts (Para [Image txt (s,'f':'i':'g':':':tit)]) = do
blockToHtml opts (Para lst) = do
contents <- inlineListToHtml opts lst
return $ H.p contents
-blockToHtml opts (Div attr bs) = do
+blockToHtml opts (Div attr@(_,classes,_) bs) = do
contents <- blockListToHtml opts bs
- return $ addAttrs opts attr $ H.div $ nl opts >> contents >> nl opts
+ let contents' = nl opts >> contents >> nl opts
+ return $
+ if "notes" `elem` classes
+ then case writerSlideVariant opts of
+ RevealJsSlides -> addAttrs opts attr $ H5.aside $ contents'
+ NoSlides -> addAttrs opts attr $ H.div $ contents'
+ _ -> mempty
+ else addAttrs opts attr $ H.div $ contents'
blockToHtml _ (RawBlock f str)
| f == Format "html" = return $ preEscapedString str
| otherwise = return mempty
diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs
index 8b05cfb43..d31e33a3a 100644
--- a/src/Text/Pandoc/Writers/LaTeX.hs
+++ b/src/Text/Pandoc/Writers/LaTeX.hs
@@ -285,7 +285,12 @@ isLineBreakOrSpace _ = False
blockToLaTeX :: Block -- ^ Block to convert
-> State WriterState Doc
blockToLaTeX Null = return empty
-blockToLaTeX (Div _ bs) = blockListToLaTeX bs
+blockToLaTeX (Div (_,classes,_) bs) = do
+ beamer <- writerBeamer `fmap` gets stOptions
+ contents <- blockListToLaTeX bs
+ if beamer && "notes" `elem` classes -- speaker notes
+ then return $ "\\note" <> braces contents
+ else return contents
blockToLaTeX (Plain lst) =
inlineListToLaTeX $ dropWhile isLineBreakOrSpace lst
-- title beginning with fig: indicates that the image is a figure