git.iko.soy/typeable/pandoc
on master help sign in
reveal.js writer: better handling of options.
14b2eb2John MacFarlane
data/templates/default.revealjs+70−128
@@ -90,256 +90,198 @@ $endif$
90 // Full list of configuration options available at:
90 // Full list of configuration options available at:
91 // https://revealjs.com/config/
91 // https://revealjs.com/config/
92 Reveal.initialize({
92 Reveal.initialize({
93−$if(center)$
94− // Determines whether slide content should be vertically centered
95− center: $center$,
96−$endif$
97−$if(controls)$
98 // Display controls in the bottom right corner
93 // Display controls in the bottom right corner
99 controls: $controls$,
94 controls: $controls$,
100−$endif$
95+
101−$if(controlsTutorial)$
102 // Help the user learn the controls by providing hints, for example by
96 // Help the user learn the controls by providing hints, for example by
103 // bouncing the down arrow when they first encounter a vertical slide
97 // bouncing the down arrow when they first encounter a vertical slide
104 controlsTutorial: $controlsTutorial$,
98 controlsTutorial: $controlsTutorial$,
105−$endif$
99+
106−$if(controlsLayout)$
107 // Determines where controls appear, "edges" or "bottom-right"
100 // Determines where controls appear, "edges" or "bottom-right"
108 controlsLayout: '$controlsLayout$',
101 controlsLayout: '$controlsLayout$',
109−$endif$
102+
110−$if(controlsBackArrows)$
111 // Visibility rule for backwards navigation arrows; "faded", "hidden"
103 // Visibility rule for backwards navigation arrows; "faded", "hidden"
112 // or "visible"
104 // or "visible"
113 controlsBackArrows: '$controlsBackArrows$',
105 controlsBackArrows: '$controlsBackArrows$',
114−$endif$
106+
115−$if(progress)$
116 // Display a presentation progress bar
107 // Display a presentation progress bar
117 progress: $progress$,
108 progress: $progress$,
118−$endif$
109+
119−$if(slideNumber)$
120 // Display the page number of the current slide
110 // Display the page number of the current slide
121 slideNumber: $slideNumber$,
111 slideNumber: $slideNumber$,
122−$endif$
112+
123−$if(showSlideNumber)$
124 // 'all', 'print', or 'speaker'
113 // 'all', 'print', or 'speaker'
125 showSlideNumber: '$showSlideNumber$',
114 showSlideNumber: '$showSlideNumber$',
126−$endif$
115+
127 // Add the current slide number to the URL hash so that reloading the
116 // Add the current slide number to the URL hash so that reloading the
128 // page/copying the URL will return you to the same slide
117 // page/copying the URL will return you to the same slide
129− hash: $if(hash)$$hash$$else$true$endif$,
118+ hash: $hash$,
130−$if(hashOneBasedIndex)$
119+
131 // Start with 1 for the hash rather than 0
120 // Start with 1 for the hash rather than 0
132 hashOneBasedIndex: $hashOneBasedIndex$,
121 hashOneBasedIndex: $hashOneBasedIndex$,
133−$endif$
122+
134−$if(history)$
123+ // Flags if we should monitor the hash and change slides accordingly
124+ respondToHashChanges: $respondToHashChanges$,
125+
135 // Push each slide change to the browser history
126 // Push each slide change to the browser history
136 history: $history$,
127 history: $history$,
137−$endif$
128+
138−$if(keyboard)$
139 // Enable keyboard shortcuts for navigation
129 // Enable keyboard shortcuts for navigation
140 keyboard: $keyboard$,
130 keyboard: $keyboard$,
141−$endif$
131+
142−$if(overview)$
143 // Enable the slide overview mode
132 // Enable the slide overview mode
144 overview: $overview$,
133 overview: $overview$,
145−$endif$
134+
146−$if(center)$
135+ // Disables the default reveal.js slide layout (scaling and centering)
136+ // so that you can use custom CSS layout
137+ disableLayout: false,
138+
147 // Vertical centering of slides
139 // Vertical centering of slides
148 center: $center$,
140 center: $center$,
149−$endif$
141+
150−$if(touch)$
151 // Enables touch navigation on devices with touch input
142 // Enables touch navigation on devices with touch input
152 touch: $touch$,
143 touch: $touch$,
153−$endif$
144+
154−$if(loop)$
155 // Loop the presentation
145 // Loop the presentation
156 loop: $loop$,
146 loop: $loop$,
157−$endif$
147+
158−$if(rtl)$
159 // Change the presentation direction to be RTL
148 // Change the presentation direction to be RTL
160 rtl: $rtl$,
149 rtl: $rtl$,
161−$endif$
150+
162−$if(navigationMode)$
163 // see https://revealjs.com/vertical-slides/#navigation-mode
151 // see https://revealjs.com/vertical-slides/#navigation-mode
164 navigationMode: '$navigationMode$',
152 navigationMode: '$navigationMode$',
165−$endif$
153+
166−$if(shuffle)$
167 // Randomizes the order of slides each time the presentation loads
154 // Randomizes the order of slides each time the presentation loads
168 shuffle: $shuffle$,
155 shuffle: $shuffle$,
169−$endif$
156+
170−$if(fragments)$
171 // Turns fragments on and off globally
157 // Turns fragments on and off globally
172 fragments: $fragments$,
158 fragments: $fragments$,
173−$endif$
159+
174−$if(fragmentInURL)$
175 // Flags whether to include the current fragment in the URL,
160 // Flags whether to include the current fragment in the URL,
176 // so that reloading brings you to the same fragment position
161 // so that reloading brings you to the same fragment position
177 fragmentInURL: $fragmentInURL$,
162 fragmentInURL: $fragmentInURL$,
178−$endif$
163+
179−$if(embedded)$
180 // Flags if the presentation is running in an embedded mode,
164 // Flags if the presentation is running in an embedded mode,
181 // i.e. contained within a limited portion of the screen
165 // i.e. contained within a limited portion of the screen
182 embedded: $embedded$,
166 embedded: $embedded$,
183−$endif$
167+
184−$if(help)$
185 // Flags if we should show a help overlay when the questionmark
168 // Flags if we should show a help overlay when the questionmark
186 // key is pressed
169 // key is pressed
187 help: $help$,
170 help: $help$,
188−$endif$
171+
189−$if(pause)$
190− // Flags if it should be possible to pause the presentation (blackout)
172+ // Flags if it should be possible to pause the presentation (blackout)
191− pause: $pause$,
173+ pause: $pause$,
192−$endif$
174+
193−$if(showNotes)$
194 // Flags if speaker notes should be visible to all viewers
175 // Flags if speaker notes should be visible to all viewers
195 showNotes: $showNotes$,
176 showNotes: $showNotes$,
196−$endif$
177+
197−$if(autoPlayMedia)$
198− // Global override for autoplaying embedded media (video/audio/iframe)
178+ // Global override for autoplaying embedded media (null/true/false)
199− // - null: Media will only autoplay if data-autoplay is present
200− // - true: All media will autoplay, regardless of individual setting
201− // - false: No media will autoplay, regardless of individual setting
202 autoPlayMedia: $autoPlayMedia$,
179 autoPlayMedia: $autoPlayMedia$,
203−$endif$
180+
204−$if(preloadIframes)$
205− // Global override for preloading lazy-loaded iframes
181+ // Global override for preloading lazy-loaded iframes (null/true/false)
206− // - null: Iframes with data-src AND data-preload will be loaded when within
207− // the viewDistance, iframes with only data-src will be loaded when visible
208− // - true: All iframes with data-src will be loaded when within the viewDistance
209− // - false: All iframes with data-src will be loaded only when visible
210 preloadIframes: $preloadIframes$,
182 preloadIframes: $preloadIframes$,
211−$endif$
183+
212−$if(autoSlide)$
213 // Number of milliseconds between automatically proceeding to the
184 // Number of milliseconds between automatically proceeding to the
214 // next slide, disabled when set to 0, this value can be overwritten
185 // next slide, disabled when set to 0, this value can be overwritten
215 // by using a data-autoslide attribute on your slides
186 // by using a data-autoslide attribute on your slides
216 autoSlide: $autoSlide$,
187 autoSlide: $autoSlide$,
217−$endif$
188+
218−$if(autoSlideStoppable)$
219 // Stop auto-sliding after user input
189 // Stop auto-sliding after user input
220 autoSlideStoppable: $autoSlideStoppable$,
190 autoSlideStoppable: $autoSlideStoppable$,
221−$endif$
191+
222−$if(autoSlideMethod)$
223 // Use this method for navigation when auto-sliding
192 // Use this method for navigation when auto-sliding
224 autoSlideMethod: $autoSlideMethod$,
193 autoSlideMethod: $autoSlideMethod$,
225−$endif$
194+
226−$if(defaultTiming)$
227 // Specify the average time in seconds that you think you will spend
195 // Specify the average time in seconds that you think you will spend
228 // presenting each slide. This is used to show a pacing timer in the
196 // presenting each slide. This is used to show a pacing timer in the
229 // speaker view
197 // speaker view
230 defaultTiming: $defaultTiming$,
198 defaultTiming: $defaultTiming$,
231−$endif$
199+
232−$if(totalTime)$
233− // Specify the total time in seconds that is available to
234− // present. If this is set to a nonzero value, the pacing
235− // timer will work out the time available for each slide,
236− // instead of using the defaultTiming value
237− totalTime: $totalTime$,
238−$endif$
239−$if(minimumTimePerSlide)$
240− // Specify the minimum amount of time you want to allot to
241− // each slide, if using the totalTime calculation method. If
242− // the automated time allocation causes slide pacing to fall
243− // below this threshold, then you will see an alert in the
244− // speaker notes window
245− minimumTimePerSlide: $minimumTimePerSlide$,
246−$endif$
247−$if(mouseWheel)$
248 // Enable slide navigation via mouse wheel
200 // Enable slide navigation via mouse wheel
249 mouseWheel: $mouseWheel$,
201 mouseWheel: $mouseWheel$,
250−$endif$
202+
251−$if(rollingLinks)$
203+ // The display mode that will be used to show slides
252− // Apply a 3D roll to links on hover
204+ display: '$display$',
253− rollingLinks: $rollingLinks$,
205+
254−$endif$
255−$if(hideInactiveCursor)$
256 // Hide cursor if inactive
206 // Hide cursor if inactive
257 hideInactiveCursor: $hideInactiveCursor$,
207 hideInactiveCursor: $hideInactiveCursor$,
258−$endif$
208+
259−$if(hideCursorTime)$
260 // Time before the cursor is hidden (in ms)
209 // Time before the cursor is hidden (in ms)
261 hideCursorTime: $hideCursorTime$,
210 hideCursorTime: $hideCursorTime$,
262−$endif$
211+
263−$if(hideAddressBar)$
264− // Hides the address bar on mobile devices
265− hideAddressBar: $hideAddressBar$,
266−$endif$
267−$if(previewLinks)$
268 // Opens links in an iframe preview overlay
212 // Opens links in an iframe preview overlay
269 previewLinks: $previewLinks$,
213 previewLinks: $previewLinks$,
270−$endif$
214+
271−$if(transition)$
272− // Transition style
273− transition: '$transition$', // none/fade/slide/convex/concave/zoom
215+ // Transition style (none/fade/slide/convex/concave/zoom)
274−$endif$
216+ transition: '$transition$',
275−$if(transitionSpeed)$
217+
276− // Transition speed
218+ // Transition speed (default/fast/slow)
277− transitionSpeed: '$transitionSpeed$', // default/fast/slow
219+ transitionSpeed: '$transitionSpeed$',
278−$endif$
220+
279−$if(backgroundTransition)$
280 // Transition style for full page slide backgrounds
221 // Transition style for full page slide backgrounds
281− backgroundTransition: '$backgroundTransition$', // none/fade/slide/convex/concave/zoom
222+ // (none/fade/slide/convex/concave/zoom)
282−$endif$
223+ backgroundTransition: '$backgroundTransition$',
283−$if(viewDistance)$
224+
284 // Number of slides away from the current that are visible
225 // Number of slides away from the current that are visible
285 viewDistance: $viewDistance$,
226 viewDistance: $viewDistance$,
286−$endif$
227+
287−$if(mobileViewDistance)$
288 // Number of slides away from the current that are visible on mobile
228 // Number of slides away from the current that are visible on mobile
289 // devices. It is advisable to set this to a lower number than
229 // devices. It is advisable to set this to a lower number than
290 // viewDistance in order to save resources.
230 // viewDistance in order to save resources.
291 mobileViewDistance: $mobileViewDistance$,
231 mobileViewDistance: $mobileViewDistance$,
292−$endif$
293$if(parallaxBackgroundImage)$
232$if(parallaxBackgroundImage)$
233+
294 // Parallax background image
234 // Parallax background image
295 parallaxBackgroundImage: '$parallaxBackgroundImage$', // e.g. "'https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg'"
235 parallaxBackgroundImage: '$parallaxBackgroundImage$', // e.g. "'https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg'"
296$else$
236$else$
297$if(background-image)$
237$if(background-image)$
238+
298 // Parallax background image
239 // Parallax background image
299 parallaxBackgroundImage: '$background-image$', // e.g. "'https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg'"
240 parallaxBackgroundImage: '$background-image$', // e.g. "'https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg'"
300$endif$
241$endif$
301$endif$
242$endif$
302$if(parallaxBackgroundSize)$
243$if(parallaxBackgroundSize)$
244+
303 // Parallax background size
245 // Parallax background size
304 parallaxBackgroundSize: '$parallaxBackgroundSize$', // CSS syntax, e.g. "2100px 900px"
246 parallaxBackgroundSize: '$parallaxBackgroundSize$', // CSS syntax, e.g. "2100px 900px"
305$endif$
247$endif$
306$if(parallaxBackgroundHorizontal)$
248$if(parallaxBackgroundHorizontal)$
249+
307 // Amount to move parallax background (horizontal and vertical) on slide change
250 // Amount to move parallax background (horizontal and vertical) on slide change
308 // Number, e.g. 100
251 // Number, e.g. 100
309 parallaxBackgroundHorizontal: $parallaxBackgroundHorizontal$,
252 parallaxBackgroundHorizontal: $parallaxBackgroundHorizontal$,
310$endif$
253$endif$
311$if(parallaxBackgroundVertical)$
254$if(parallaxBackgroundVertical)$
255+
312 parallaxBackgroundVertical: $parallaxBackgroundVertical$,
256 parallaxBackgroundVertical: $parallaxBackgroundVertical$,
313$endif$
257$endif$
314$if(width)$
258$if(width)$
259+
315 // The "normal" size of the presentation, aspect ratio will be preserved
260 // The "normal" size of the presentation, aspect ratio will be preserved
316 // when the presentation is scaled to fit different resolutions. Can be
261 // when the presentation is scaled to fit different resolutions. Can be
317 // specified using percentage units.
262 // specified using percentage units.
318 width: $width$,
263 width: $width$,
319$endif$
264$endif$
320$if(height)$
265$if(height)$
266+
321 height: $height$,
267 height: $height$,
322$endif$
268$endif$
323$if(margin)$
269$if(margin)$
270+
324 // Factor of the display size that should remain empty around the content
271 // Factor of the display size that should remain empty around the content
325 margin: $margin$,
272 margin: $margin$,
326$endif$
273$endif$
327$if(minScale)$
274$if(minScale)$
275+
328 // Bounds for smallest/largest possible scale to apply to content
276 // Bounds for smallest/largest possible scale to apply to content
329 minScale: $minScale$,
277 minScale: $minScale$,
330$endif$
278$endif$
331$if(maxScale)$
279$if(maxScale)$
280+
332 maxScale: $maxScale$,
281 maxScale: $maxScale$,
333$endif$
282$endif$
334−$if(zoomKey)$
335− // Modifier key used to click-zoom to part of the slide
336− zoomKey: '$zoomKey$',
337−$endif$
338−$if(display)$
339− // The display mode that will be used to show slides
340− display: '$display$',
341−$endif$
342$if(mathjax)$
283$if(mathjax)$
284+
343 math: {
285 math: {
344 mathjax: '$mathjaxurl$',
286 mathjax: '$mathjaxurl$',
345 config: 'TeX-AMS_HTML-full',
287 config: 'TeX-AMS_HTML-full',
src/Text/Pandoc/Writers/HTML.hs+50
@@ -317,6 +317,10 @@ pandocToHtml opts (Pandoc meta blocks) = do
317 | otherwise -> mempty
317 | otherwise -> mempty
318 Nothing -> mempty
318 Nothing -> mempty
319 let mCss :: Maybe [Text] = lookupContext "css" metadata
319 let mCss :: Maybe [Text] = lookupContext "css" metadata
320+ let true :: Text
321+ true = "true"
322+ let false :: Text
323+ false = "false"
320 let context = (if stHighlighting st
324 let context = (if stHighlighting st
321 then case writerHighlightStyle opts of
325 then case writerHighlightStyle opts of
322 Just sty -> defField "highlighting-css"
326 Just sty -> defField "highlighting-css"
@@ -344,6 +348,52 @@ pandocToHtml opts (Pandoc meta blocks) = do
344 PlainMath -> defField "displaymath-css" True
348 PlainMath -> defField "displaymath-css" True
345 WebTeX _ -> defField "displaymath-css" True
349 WebTeX _ -> defField "displaymath-css" True
346 _ -> id) .
350 _ -> id) .
351+ (if slideVariant == RevealJsSlides
352+ then -- set boolean options explicitly, since
353+ -- template can't distinguish False/undefined
354+ defField "controls" true .
355+ defField "controlsTutorial" true .
356+ defField "controlsLayout" ("bottom-right" :: Text) .
357+ defField "controlsBackArrows" ("faded" :: Text) .
358+ defField "progress" true .
359+ defField "slideNumber" false .
360+ defField "showSlideNumber" ("all" :: Text) .
361+ defField "hashOneBasedIndex" false .
362+ defField "hash" false .
363+ defField "respondToHashChanges" true .
364+ defField "history" false .
365+ defField "keyboard" true .
366+ defField "overview" true .
367+ defField "disableLayout" false .
368+ defField "center" true .
369+ defField "touch" true .
370+ defField "loop" false .
371+ defField "rtl" false .
372+ defField "navigationMode" ("default" :: Text) .
373+ defField "shuffle" false .
374+ defField "fragments" true .
375+ defField "fragmentInURL" true .
376+ defField "embedded" false .
377+ defField "help" true .
378+ defField "pause" true .
379+ defField "showNotes" false .
380+ defField "autoPlayMedia" ("null" :: Text) .
381+ defField "preloadIframes" ("null" :: Text) .
382+ defField "autoSlide" ("0" :: Text) .
383+ defField "autoSlideStoppable" true .
384+ defField "autoSlideMethod" ("null" :: Text) .
385+ defField "defaultTiming" ("null" :: Text) .
386+ defField "mouseWheel" false .
387+ defField "display" ("block" :: Text) .
388+ defField "hideInactiveCursor" true .
389+ defField "hideCursorTime" ("5000" :: Text) .
390+ defField "previewLinks" false .
391+ defField "transition" ("slide" :: Text) .
392+ defField "transitionSpeed" ("default" :: Text) .
393+ defField "backgroundTransition" ("fade" :: Text) .
394+ defField "viewDistance" ("3" :: Text) .
395+ defField "mobileViewDistance" ("2" :: Text)
396+ else id) .
347 defField "document-css" (isNothing mCss && slideVariant == NoSlides) .
397 defField "document-css" (isNothing mCss && slideVariant == NoSlides) .
348 defField "quotes" (stQuotes st) .
398 defField "quotes" (stQuotes st) .
349 -- for backwards compatibility we populate toc
399 -- for backwards compatibility we populate toc