aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2021-06-21 16:40:52 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2021-06-21 16:40:52 -0700
commit14b2eb2aeb21b3dee7d07c7348ebd2c586d6a866 (patch)
tree7f2a837be09a2bcff4bf6a5d6cf136dec75f19be /src/Text/Pandoc
parenta39313eddbc84c7680d4bc7cef7770b18c89260a (diff)
downloadpandoc-14b2eb2aeb21b3dee7d07c7348ebd2c586d6a866.tar.gz
reveal.js writer: better handling of options.
Previously it was impossible to specify false values for options that default to true; setting the option to false just caused the portion of the template setting the option to be omitted. Now we prepopulate all the variables with their default values, including them unconditionally and allowing them to be overridden.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Writers/HTML.hs50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs
index b1dd9a659..4d513df3b 100644
--- a/src/Text/Pandoc/Writers/HTML.hs
+++ b/src/Text/Pandoc/Writers/HTML.hs
@@ -317,6 +317,10 @@ pandocToHtml opts (Pandoc meta blocks) = do
| otherwise -> mempty
Nothing -> mempty
let mCss :: Maybe [Text] = lookupContext "css" metadata
+ let true :: Text
+ true = "true"
+ let false :: Text
+ false = "false"
let context = (if stHighlighting st
then case writerHighlightStyle opts of
Just sty -> defField "highlighting-css"
@@ -344,6 +348,52 @@ pandocToHtml opts (Pandoc meta blocks) = do
PlainMath -> defField "displaymath-css" True
WebTeX _ -> defField "displaymath-css" True
_ -> id) .
+ (if slideVariant == RevealJsSlides
+ then -- set boolean options explicitly, since
+ -- template can't distinguish False/undefined
+ defField "controls" true .
+ defField "controlsTutorial" true .
+ defField "controlsLayout" ("bottom-right" :: Text) .
+ defField "controlsBackArrows" ("faded" :: Text) .
+ defField "progress" true .
+ defField "slideNumber" false .
+ defField "showSlideNumber" ("all" :: Text) .
+ defField "hashOneBasedIndex" false .
+ defField "hash" false .
+ defField "respondToHashChanges" true .
+ defField "history" false .
+ defField "keyboard" true .
+ defField "overview" true .
+ defField "disableLayout" false .
+ defField "center" true .
+ defField "touch" true .
+ defField "loop" false .
+ defField "rtl" false .
+ defField "navigationMode" ("default" :: Text) .
+ defField "shuffle" false .
+ defField "fragments" true .
+ defField "fragmentInURL" true .
+ defField "embedded" false .
+ defField "help" true .
+ defField "pause" true .
+ defField "showNotes" false .
+ defField "autoPlayMedia" ("null" :: Text) .
+ defField "preloadIframes" ("null" :: Text) .
+ defField "autoSlide" ("0" :: Text) .
+ defField "autoSlideStoppable" true .
+ defField "autoSlideMethod" ("null" :: Text) .
+ defField "defaultTiming" ("null" :: Text) .
+ defField "mouseWheel" false .
+ defField "display" ("block" :: Text) .
+ defField "hideInactiveCursor" true .
+ defField "hideCursorTime" ("5000" :: Text) .
+ defField "previewLinks" false .
+ defField "transition" ("slide" :: Text) .
+ defField "transitionSpeed" ("default" :: Text) .
+ defField "backgroundTransition" ("fade" :: Text) .
+ defField "viewDistance" ("3" :: Text) .
+ defField "mobileViewDistance" ("2" :: Text)
+ else id) .
defField "document-css" (isNothing mCss && slideVariant == NoSlides) .
defField "quotes" (stQuotes st) .
-- for backwards compatibility we populate toc