summaryrefslogtreecommitdiff
path: root/src/pandoc.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2011-12-29 17:41:06 -0800
committerJohn MacFarlane <fiddlosopher@gmail.com>2011-12-29 17:41:06 -0800
commit31fb776c32ad24dd4e9fbf8e547350423ff53ccd (patch)
tree25d26ec0b926c9ba36536e33eb84910ec832c41f /src/pandoc.hs
parentcd190be09e6e41c6dd7669191eeb1b4d7f0697b9 (diff)
DZSlides: Added dzslides/template.html.
This is the unaltered file from the dzslides repository. Pandoc now reads it, looking for the core part, and includes this in the new dzslides template via the 'dzslides-core' variable. When dzslides is updated, you can just put the new template.html in your `~/.pandoc/dzslides` directory, and things should work -- provided the core part can be identified as everything from <!-- {{{{ dzslides core to the end of the file. This should make it a bit easier to keep up to date.
Diffstat (limited to 'src/pandoc.hs')
-rw-r--r--src/pandoc.hs24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/pandoc.hs b/src/pandoc.hs
index 6944a6a78..190248a29 100644
--- a/src/pandoc.hs
+++ b/src/pandoc.hs
@@ -40,7 +40,7 @@ import System.Exit ( exitWith, ExitCode (..) )
import System.FilePath
import System.Console.GetOpt
import Data.Char ( toLower )
-import Data.List ( intercalate, isSuffixOf )
+import Data.List ( intercalate, isSuffixOf, isPrefixOf )
import System.Directory ( getAppUserDataDirectory, doesFileExist )
import System.IO ( stdout, stderr )
import System.IO.Error ( isDoesNotExistError )
@@ -798,6 +798,12 @@ main = do
(\_ -> throwIO e)
else throwIO e)
+ let slideVariant = case writerName' of
+ "s5" -> S5Slides
+ "slidy" -> SlidySlides
+ "dzslides" -> DZSlides
+ _ -> NoSlides
+
variables' <- case mathMethod of
LaTeXMathML Nothing -> do
s <- readDataFile datadir $ "data" </> "LaTeXMathML.js"
@@ -807,6 +813,14 @@ main = do
return $ ("mathml-script", s) : variables
_ -> return variables
+ variables'' <- case slideVariant of
+ DZSlides -> do
+ dztempl <- readDataFile datadir $ "dzslides" </> "template.html"
+ let dzcore = unlines $ dropWhile (not . isPrefixOf "<!-- {{{{ dzslides core")
+ $ lines dztempl
+ return $ ("dzslides-core", dzcore) : variables'
+ _ -> return variables'
+
refs <- mapM (\f -> catch (CSL.readBiblioFile f) $ \e -> do
UTF8.hPutStrLn stderr $ "Error reading bibliography `" ++ f ++ "'"
UTF8.hPutStrLn stderr $ show e
@@ -816,12 +830,6 @@ main = do
then "."
else takeDirectory (head sources)
- let slideVariant = case writerName' of
- "s5" -> S5Slides
- "slidy" -> SlidySlides
- "dzslides" -> DZSlides
- _ -> NoSlides
-
let startParserState =
defaultParserState { stateParseRaw = parseRaw,
stateTabStop = tabStop,
@@ -840,7 +848,7 @@ main = do
let writerOptions = defaultWriterOptions
{ writerStandalone = standalone',
writerTemplate = templ,
- writerVariables = variables',
+ writerVariables = variables'',
writerEPUBMetadata = epubMetadata,
writerTabStop = tabStop,
writerTableOfContents = toc &&