summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2012-07-23 22:53:35 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2012-07-23 22:53:35 -0700
commit1bd0c479685fd009ba3c808e6fea3fac24f26428 (patch)
tree58550ee51e0ea74e2fdb301263861cf7ac0bae93
parentd2cc56a46a5a3c657429e8df5b93c82f3f9ed9fb (diff)
Set writerSlideVariant in Text.Pandoc rather than pandoc.hs.
-rw-r--r--src/Text/Pandoc.hs13
-rw-r--r--src/pandoc.hs87
2 files changed, 47 insertions, 53 deletions
diff --git a/src/Text/Pandoc.hs b/src/Text/Pandoc.hs
index 0a2c613b1..b27651049 100644
--- a/src/Text/Pandoc.hs
+++ b/src/Text/Pandoc.hs
@@ -191,10 +191,15 @@ writers = [("native" , writeNative)
,("html5+lhs" , \o ->
writeHtmlString o{ writerLiterateHaskell = True,
writerHtml5 = True })
- ,("s5" , writeHtmlString)
- ,("slidy" , writeHtmlString)
- ,("slideous" , writeHtmlString)
- ,("dzslides" , writeHtmlString)
+ ,("s5" , \o ->
+ writeHtmlString o{ writerSlideVariant = S5Slides })
+ ,("slidy" , \o ->
+ writeHtmlString o{ writerSlideVariant = SlidySlides })
+ ,("slideous" , \o ->
+ writeHtmlString o{ writerSlideVariant = SlideousSlides })
+ ,("dzslides" , \o ->
+ writeHtmlString o{ writerSlideVariant = DZSlides
+ , writerHtml5 = True })
,("docbook" , writeDocbook)
,("opendocument" , writeOpenDocument)
,("latex" , writeLaTeX)
diff --git a/src/pandoc.hs b/src/pandoc.hs
index a0a26444d..631ed9d91 100644
--- a/src/pandoc.hs
+++ b/src/pandoc.hs
@@ -902,13 +902,6 @@ main = do
(\_ -> throwIO e)
else throwIO e)
- let slideVariant = case writerName' of
- "s5" -> S5Slides
- "slidy" -> SlidySlides
- "slideous" -> SlideousSlides
- "dzslides" -> DZSlides
- _ -> NoSlides
-
variables' <- case mathMethod of
LaTeXMathML Nothing -> do
s <- readDataFile datadir $ "data" </> "LaTeXMathML.js"
@@ -918,8 +911,8 @@ main = do
return $ ("mathml-script", s) : variables
_ -> return variables
- variables'' <- case slideVariant of
- DZSlides -> do
+ variables'' <- case writerName' of
+ "dzslides" -> do
dztempl <- readDataFile datadir $ "dzslides" </> "template.html"
let dzcore = unlines $ dropWhile (not . isPrefixOf "<!-- {{{{ dzslides core")
$ lines dztempl
@@ -939,8 +932,7 @@ main = do
then "."
else takeDirectory (head sources)
- let startParserState =
- defaultParserState { stateParseRaw = parseRaw,
+ let startParserState = def{ stateParseRaw = parseRaw,
stateTabStop = tabStop,
stateLiterateHaskell = "+lhs" `isSuffixOf` readerName' ||
lhsExtension sources,
@@ -955,44 +947,41 @@ main = do
stateApplyMacros = not laTeXOutput
}
- let writerOptions = defaultWriterOptions
- { writerStandalone = standalone',
- writerTemplate = templ,
- writerVariables = variables'',
- writerEPUBMetadata = epubMetadata,
- writerTabStop = tabStop,
- writerTableOfContents = toc &&
- writerName' /= "s5",
- writerHTMLMathMethod = mathMethod,
- writerSlideVariant = slideVariant,
- writerIncremental = incremental,
- writerCiteMethod = citeMethod,
- writerBiblioFiles = reffiles,
- writerIgnoreNotes = False,
- writerNumberSections = numberSections,
- writerSectionDivs = sectionDivs,
- writerStrictMarkdown = strict,
- writerReferenceLinks = referenceLinks,
- writerWrapText = wrap,
- writerColumns = columns,
- writerLiterateHaskell = False,
- writerEmailObfuscation = if strict
- then ReferenceObfuscation
- else obfuscationMethod,
- writerIdentifierPrefix = idPrefix,
- writerSourceDirectory = sourceDir,
- writerUserDataDir = datadir,
- writerHtml5 = html5 ||
- slideVariant == DZSlides,
- writerChapters = chapters,
- writerListings = listings,
- writerBeamer = False,
- writerSlideLevel = slideLevel,
- writerHighlight = highlight,
- writerHighlightStyle = highlightStyle,
- writerSetextHeaders = setextHeaders,
- writerTeXLigatures = texLigatures
- }
+ let writerOptions = def { writerStandalone = standalone',
+ writerTemplate = templ,
+ writerVariables = variables'',
+ writerEPUBMetadata = epubMetadata,
+ writerTabStop = tabStop,
+ writerTableOfContents = toc &&
+ writerName' /= "s5",
+ writerHTMLMathMethod = mathMethod,
+ writerIncremental = incremental,
+ writerCiteMethod = citeMethod,
+ writerBiblioFiles = reffiles,
+ writerIgnoreNotes = False,
+ writerNumberSections = numberSections,
+ writerSectionDivs = sectionDivs,
+ writerStrictMarkdown = strict,
+ writerReferenceLinks = referenceLinks,
+ writerWrapText = wrap,
+ writerColumns = columns,
+ writerLiterateHaskell = False,
+ writerEmailObfuscation = if strict
+ then ReferenceObfuscation
+ else obfuscationMethod,
+ writerIdentifierPrefix = idPrefix,
+ writerSourceDirectory = sourceDir,
+ writerUserDataDir = datadir,
+ writerHtml5 = html5,
+ writerChapters = chapters,
+ writerListings = listings,
+ writerBeamer = False,
+ writerSlideLevel = slideLevel,
+ writerHighlight = highlight,
+ writerHighlightStyle = highlightStyle,
+ writerSetextHeaders = setextHeaders,
+ writerTeXLigatures = texLigatures
+ }
when (writerName' `elem` nonTextFormats&& outputFile == "-") $
err 5 $ "Cannot write " ++ writerName' ++ " output to stdout.\n" ++