Permalink
Browse files

Added dzslides and asciidoc as export options.

  • Loading branch information...
1 parent 56b0ee4 commit f7e9e628714ec1f853995ac28e80ea3bd2d7b7d0 John MacFarlane committed Feb 26, 2012
Showing with 20 additions and 9 deletions.
  1. +20 −9 Network/Gitit/Export.hs
View
29 Network/Gitit/Export.hs
@@ -46,6 +46,7 @@ import System.Process (runProcess, waitForProcess)
import Codec.Binary.UTF8.String (encodeString)
import Text.HTML.SanitizeXSS
import qualified Data.Text as T
+import Data.List (isPrefixOf)
defaultRespOptions :: WriterOptions
defaultRespOptions = defaultWriterOptions { writerStandalone = True }
@@ -99,6 +100,7 @@ respondSlides templ slideVariant _page doc = do
let opts' = defaultRespOptions {
writerSlideVariant = slideVariant
,writerIncremental = True
+ ,writerHtml5 = templ == "dzslides"
,writerHTMLMathMethod = math}
-- We sanitize the body only, to protect against XSS attacks.
-- (Sanitizing the whole HTML page would strip out javascript
@@ -118,9 +120,18 @@ respondSlides templ slideVariant _page doc = do
template <- case template' of
Right t -> return t
Left e -> liftIO $ throwIO e
+ dzcore <- if templ == "dzslides"
+ then do
+ dztempl <- liftIO $ readDataFile (pandocUserData cfg)
+ $ "dzslides" </> "template.html"
+ return $ unlines
+ $ dropWhile (not . isPrefixOf "<!-- {{{{ dzslides core")
+ $ lines dztempl
+ else return ""
let Pandoc meta _ = doc
let h = writeHtmlString opts'{
- writerVariables = ("body",body''):variables'
+ writerVariables =
+ ("body",body''):("dzslides-core",dzcore):variables'
,writerTemplate = template
,writerSourceDirectory = repositoryPath cfg
,writerUserDataDir = pandocUserData cfg
@@ -159,12 +170,6 @@ respondMan :: String -> Pandoc -> Handler
respondMan = respondS "man" "text/plain; charset=utf-8" ""
writeMan defaultRespOptions
-respondS5 :: String -> Pandoc -> Handler
-respondS5 = respondSlides "s5" S5Slides
-
-respondSlidy :: String -> Pandoc -> Handler
-respondSlidy = respondSlides "slidy" SlidySlides
-
respondTexinfo :: String -> Pandoc -> Handler
respondTexinfo = respondS "texinfo" "application/x-texinfo" "texi"
writeTexinfo defaultRespOptions
@@ -181,6 +186,10 @@ respondTextile :: String -> Pandoc -> Handler
respondTextile = respondS "textile" "text/plain; charset=utf-8" ""
writeTextile defaultRespOptions
+respondAsciiDoc :: String -> Pandoc -> Handler
+respondAsciiDoc = respondS "asciidoc" "text/plain; charset=utf-8" ""
+ writeAsciiDoc defaultRespOptions
+
respondMediaWiki :: String -> Pandoc -> Handler
respondMediaWiki = respondS "mediawiki" "text/plain; charset=utf-8" ""
writeMediaWiki defaultRespOptions
@@ -285,10 +294,12 @@ exportFormats cfg = if pdfExport cfg
, ("MediaWiki", respondMediaWiki)
, ("man", respondMan)
, ("DocBook", respondDocbook)
- , ("Slidy", respondSlidy)
- , ("S5", respondS5)
+ , ("Slidy", respondSlides "slidy" SlidySlides)
+ , ("S5", respondSlides "s5" S5Slides)
+ , ("DZSlides", respondSlides "dzslides" DZSlides)
, ("ODT", respondODT)
, ("EPUB", respondEPUB)
, ("Org", respondOrg)
, ("Textile", respondTextile)
+ , ("AsciiDoc", respondAsciiDoc)
, ("RTF", respondRTF) ]

0 comments on commit f7e9e62

Please sign in to comment.