diff options
author | John MacFarlane <jgm@berkeley.edu> | 2013-03-21 15:21:53 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2013-03-21 15:21:53 -0700 |
commit | 5b424f881d271c3ef2d40bcf8b0b50b1cd367b98 (patch) | |
tree | 3b239b43cd7cff60d5ea9f6971b04ac18e769ab3 | |
parent | 6b53a905c4f4578d275cf7567038d4b870b94848 (diff) | |
download | pandoc-5b424f881d271c3ef2d40bcf8b0b50b1cd367b98.tar.gz |
Support incremental slide view for definition lists.
All slide formats supported.
Simplified some list code.
-rw-r--r-- | src/Text/Pandoc/Writers/HTML.hs | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index fa64a8212..b480f4eec 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -226,18 +226,20 @@ prefixedId opts s = 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' + then (listop $ mconcat items) ! A.class_ "incremental" + else listop $ mconcat $ map (! A.class_ "fragment") items + else listop $ mconcat items unordList :: WriterOptions -> [Html] -> Html -unordList = toList H.ul +unordList opts = toList H.ul opts . toListItems opts ordList :: WriterOptions -> [Html] -> Html -ordList = toList H.ol +ordList opts = toList H.ol opts . toListItems opts + +defList :: WriterOptions -> [Html] -> Html +defList opts items = toList H.dl opts (items ++ [nl opts]) -- | Construct table of contents from list of elements. tableOfContents :: WriterOptions -> [Element] -> State WriterState (Maybe Html) @@ -456,6 +458,9 @@ blockToHtml opts (BlockQuote blocks) = [OrderedList attribs lst] -> blockToHtml (opts {writerIncremental = inc}) (OrderedList attribs lst) + [DefinitionList lst] -> + blockToHtml (opts {writerIncremental = inc}) + (DefinitionList lst) _ -> do contents <- blockListToHtml opts blocks return $ H.blockquote $ nl opts >> contents >> nl opts @@ -513,11 +518,7 @@ blockToHtml opts (DefinitionList lst) = do blockListToHtml opts) defs return $ mconcat $ nl opts : term' : nl opts : intersperse (nl opts) defs') lst - let lst' = H.dl $ mconcat contents >> nl opts - let lst'' = if writerIncremental opts - then lst' ! A.class_ "incremental" - else lst' - return lst'' + return $ defList opts contents blockToHtml opts (Table capt aligns widths headers rows') = do captionDoc <- if null capt then return mempty |