summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers
diff options
context:
space:
mode:
authorJamie F. Olson <jamie.f.olson@gmail.com>2013-03-20 16:59:47 -0400
committerJohn MacFarlane <jgm@berkeley.edu>2013-03-21 14:54:17 -0700
commit6b53a905c4f4578d275cf7567038d4b870b94848 (patch)
tree249456bbc32df344ab99310c8f74704e45ddc6f9 /src/Text/Pandoc/Writers
parentff9af6c9e50bbe6d6bc58427338b703513622094 (diff)
Added basic support for reveal.js.
Support unordered and ordered lists with "fragment" elements. Modified by JGM to remove the --reveal_js-url command-line option. Instead use -V reveal_js-url=... as with slidy and the other slide formats. Also cleaned up the list code in the HTML writer.
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r--src/Text/Pandoc/Writers/HTML.hs30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs
index 1ea4442f9..fa64a8212 100644
--- a/src/Text/Pandoc/Writers/HTML.hs
+++ b/src/Text/Pandoc/Writers/HTML.hs
@@ -224,13 +224,20 @@ prefixedId opts s =
"" -> mempty
_ -> A.id $ toValue $ writerIdentifierPrefix opts ++ s
--- | Replacement for Text.XHtml's unordList.
-unordList :: WriterOptions -> ([Html] -> Html)
-unordList opts items = H.ul $ mconcat $ toListItems opts items
+toList :: (Html -> Html) -> WriterOptions -> ([Html] -> Html)
+toList listop opts items = do
+ let items' = toListItems opts items
+ if (writerIncremental opts)
+ then if (writerSlideVariant opts /= RevealJsSlides)
+ then (listop $ mconcat items') ! A.class_ "incremental"
+ else listop $ mconcat $ map (! A.class_ "fragment") items'
+ else listop $ mconcat items'
--- | Replacement for Text.XHtml's ordList.
-ordList :: WriterOptions -> ([Html] -> Html)
-ordList opts items = H.ol $ mconcat $ toListItems opts items
+unordList :: WriterOptions -> [Html] -> Html
+unordList = toList H.ul
+
+ordList :: WriterOptions -> [Html] -> Html
+ordList = toList H.ol
-- | Construct table of contents from list of elements.
tableOfContents :: WriterOptions -> [Element] -> State WriterState (Maybe Html)
@@ -476,18 +483,11 @@ blockToHtml opts (Header level (ident,_,_) lst) = do
_ -> H.p contents''
blockToHtml opts (BulletList lst) = do
contents <- mapM (blockListToHtml opts) lst
- let lst' = unordList opts contents
- let lst'' = if writerIncremental opts
- then lst' ! A.class_ "incremental"
- else lst'
- return lst''
+ return $ unordList opts contents
blockToHtml opts (OrderedList (startnum, numstyle, _) lst) = do
contents <- mapM (blockListToHtml opts) lst
let numstyle' = camelCaseToHyphenated $ show numstyle
- let attribs = (if writerIncremental opts
- then [A.class_ "incremental"]
- else []) ++
- (if startnum /= 1
+ let attribs = (if startnum /= 1
then [A.start $ toValue startnum]
else []) ++
(if numstyle /= DefaultStyle