git.iko.soy/typeable/pandoc
on master help sign in
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.

commit6b53a905c4f4578d275cf7567038d4b870b94848 authorJamie F. Olson <jamie.f.olson@gmail.com> dateWed 20 Mar 2013, 16:59 (14 years ago) parentff9af6c
6 files changed+22−18
data/templates+1−1 pandoc.hs+1−1 src/Text/Pandoc.hs+3 src/Text/Pandoc/Options.hs+1 src/Text/Pandoc/Slides.hs+1−1 src/Text/Pandoc/Writers/HTML.hs+15−15
data/templates+1−1

Submodule changed.

pandoc.hs+1−1
@@ -1113,7 +1113,7 @@ main = do
11131113 >>= writerFn outputFile . handleEntities
11141114 where htmlFormat = writerName' `elem`
11151115 ["html","html+lhs","html5","html5+lhs",
1116− "s5","slidy","slideous","dzslides"]
1116+ "s5","slidy","slideous","dzslides","reveal_js"]
11171117 selfcontain = if selfContained && htmlFormat
11181118 then makeSelfContained datadir
11191119 else return
src/Text/Pandoc.hs+3
@@ -231,6 +231,9 @@ writers = [
231231 ,("dzslides" , PureStringWriter $ \o ->
232232 writeHtmlString o{ writerSlideVariant = DZSlides
233233 , writerHtml5 = True })
234+ ,("reveal_js" , PureStringWriter $ \o ->
235+ writeHtmlString o{ writerSlideVariant = RevealJsSlides
236+ , writerHtml5 = True })
234237 ,("docbook" , PureStringWriter writeDocbook)
235238 ,("opml" , PureStringWriter writeOPML)
236239 ,("opendocument" , PureStringWriter writeOpenDocument)
src/Text/Pandoc/Options.hs+1
@@ -255,6 +255,7 @@ data HTMLSlideVariant = S5Slides
255255 | SlidySlides
256256 | SlideousSlides
257257 | DZSlides
258+ | RevealJsSlides
258259 | NoSlides
259260 deriving (Show, Read, Eq)
260261
src/Text/Pandoc/Slides.hs+1−1
@@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2626 Portability : portable
2727
2828Utility functions for splitting documents into slides for slide
29−show formats (dzslides, s5, slidy, slideous, beamer).
29+show formats (dzslides, reveal_js, s5, slidy, slideous, beamer).
3030-}
3131module Text.Pandoc.Slides ( getSlideLevel, prepSlides ) where
3232import Text.Pandoc.Definition
src/Text/Pandoc/Writers/HTML.hs+15−15
@@ -224,13 +224,20 @@ prefixedId opts s =
224224 "" -> mempty
225225 _ -> A.id $ toValue $ writerIdentifierPrefix opts ++ s
226226
227−-- | Replacement for Text.XHtml's unordList.
228−unordList :: WriterOptions -> ([Html] -> Html)
229−unordList opts items = H.ul $ mconcat $ toListItems opts items
227+toList :: (Html -> Html) -> WriterOptions -> ([Html] -> Html)
228+toList listop opts items = do
229+ let items' = toListItems opts items
230+ if (writerIncremental opts)
231+ then if (writerSlideVariant opts /= RevealJsSlides)
232+ then (listop $ mconcat items') ! A.class_ "incremental"
233+ else listop $ mconcat $ map (! A.class_ "fragment") items'
234+ else listop $ mconcat items'
230235
231−-- | Replacement for Text.XHtml's ordList.
232−ordList :: WriterOptions -> ([Html] -> Html)
233−ordList opts items = H.ol $ mconcat $ toListItems opts items
236+unordList :: WriterOptions -> [Html] -> Html
237+unordList = toList H.ul
238+
239+ordList :: WriterOptions -> [Html] -> Html
240+ordList = toList H.ol
234241
235242-- | Construct table of contents from list of elements.
236243tableOfContents :: WriterOptions -> [Element] -> State WriterState (Maybe Html)
@@ -476,18 +483,11 @@ blockToHtml opts (Header level (ident,_,_) lst) = do
476483 _ -> H.p contents''
477484blockToHtml opts (BulletList lst) = do
478485 contents <- mapM (blockListToHtml opts) lst
479− let lst' = unordList opts contents
480− let lst'' = if writerIncremental opts
481− then lst' ! A.class_ "incremental"
482− else lst'
483− return lst''
486+ return $ unordList opts contents
484487blockToHtml opts (OrderedList (startnum, numstyle, _) lst) = do
485488 contents <- mapM (blockListToHtml opts) lst
486489 let numstyle' = camelCaseToHyphenated $ show numstyle
487− let attribs = (if writerIncremental opts
488− then [A.class_ "incremental"]
489− else []) ++
490− (if startnum /= 1
490+ let attribs = (if startnum /= 1
491491 then [A.start $ toValue startnum]
492492 else []) ++
493493 (if numstyle /= DefaultStyle