mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-30 17:59:17 +08:00
Revealjs writer: default scrollProgress to 'auto'.
RevealJS defaults scrollProgress to 'auto', but the writer was setting it to true. Use lookupMeta to distinguish between MetaBool True, MetaBool False, and unset (defaulting to 'auto'). The template uses a helper variable scrollProgressAuto since pandoc templates cannot distinguish a MetaString "auto" from MetaBool True in a single variable.
This commit is contained in:
committed by
John MacFarlane
parent
bf96353c48
commit
7bd9dbecdc
@@ -243,7 +243,13 @@ $if(view)$
|
||||
// Enable scroll view
|
||||
view: '$view/nowrap$',
|
||||
// see https://revealjs.com/scroll-view/#scrollbar
|
||||
$if(scrollProgressAuto)$
|
||||
scrollProgress: 'auto',
|
||||
$elseif(scrollProgress)$
|
||||
scrollProgress: $scrollProgress$,
|
||||
$else$
|
||||
scrollProgress: false,
|
||||
$endif$
|
||||
// see https://revealjs.com/scroll-view/#url-activation
|
||||
scrollActivationWidth: $scrollActivationWidth$,
|
||||
// see https://revealjs.com/scroll-view/#scroll-snapping
|
||||
|
||||
@@ -434,7 +434,11 @@ pandocToHtml opts (Pandoc meta blocks) = do
|
||||
defField "backgroundTransition" ("fade" :: Doc Text) .
|
||||
defField "viewDistance" ("3" :: Doc Text) .
|
||||
defField "mobileViewDistance" ("2" :: Doc Text) .
|
||||
defField "scrollProgress" True .
|
||||
(case lookupMeta "scrollProgress" meta of
|
||||
Just (MetaBool False) -> id
|
||||
Just (MetaBool True) ->
|
||||
defField "scrollProgress" True
|
||||
_ -> defField "scrollProgressAuto" True) .
|
||||
defField "scrollActivationWidth" ("0" :: Doc Text) .
|
||||
defField "scrollSnap" ("mandatory" :: Doc Text) .
|
||||
defField "scrollLayout" ("full" :: Doc Text) .
|
||||
|
||||
@@ -6,6 +6,7 @@ view: scroll
|
||||
^D
|
||||
scrollActivationWidth: 0,
|
||||
scrollSnap: 'mandatory',
|
||||
scrollProgress: 'auto',
|
||||
```
|
||||
|
||||
```
|
||||
@@ -17,6 +18,7 @@ scrollSnap: false
|
||||
^D
|
||||
scrollActivationWidth: 0,
|
||||
scrollSnap: false,
|
||||
scrollProgress: 'auto',
|
||||
```
|
||||
|
||||
```
|
||||
@@ -28,6 +30,7 @@ scrollSnap: proximity
|
||||
^D
|
||||
scrollActivationWidth: 0,
|
||||
scrollSnap: 'proximity',
|
||||
scrollProgress: 'auto',
|
||||
```
|
||||
|
||||
```
|
||||
@@ -39,4 +42,41 @@ scrollActivationWidth: 500
|
||||
^D
|
||||
scrollActivationWidth: 500,
|
||||
scrollSnap: 'mandatory',
|
||||
scrollProgress: 'auto',
|
||||
```
|
||||
|
||||
```
|
||||
% pandoc -t revealjs --template=command/11486/scroll.revealjs
|
||||
---
|
||||
view: scroll
|
||||
scrollProgress: true
|
||||
---
|
||||
^D
|
||||
scrollActivationWidth: 0,
|
||||
scrollSnap: 'mandatory',
|
||||
scrollProgress: true,
|
||||
```
|
||||
|
||||
```
|
||||
% pandoc -t revealjs --template=command/11486/scroll.revealjs
|
||||
---
|
||||
view: scroll
|
||||
scrollProgress: false
|
||||
---
|
||||
^D
|
||||
scrollActivationWidth: 0,
|
||||
scrollSnap: 'mandatory',
|
||||
scrollProgress: false,
|
||||
```
|
||||
|
||||
```
|
||||
% pandoc -t revealjs --template=command/11486/scroll.revealjs
|
||||
---
|
||||
view: scroll
|
||||
scrollProgress: auto
|
||||
---
|
||||
^D
|
||||
scrollActivationWidth: 0,
|
||||
scrollSnap: 'mandatory',
|
||||
scrollProgress: 'auto',
|
||||
```
|
||||
|
||||
@@ -5,4 +5,11 @@ $if(scrollSnap)$
|
||||
$else$
|
||||
scrollSnap: false,
|
||||
$endif$
|
||||
$if(scrollProgressAuto)$
|
||||
scrollProgress: 'auto',
|
||||
$elseif(scrollProgress)$
|
||||
scrollProgress: $scrollProgress$,
|
||||
$else$
|
||||
scrollProgress: false,
|
||||
$endif$
|
||||
$endif$
|
||||
|
||||
Reference in New Issue
Block a user