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:
Christophe Dervieux
2026-02-24 14:13:18 +01:00
committed by John MacFarlane
parent bf96353c48
commit 7bd9dbecdc
4 changed files with 58 additions and 1 deletions
+6
View File
@@ -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
+5 -1
View File
@@ -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) .
+40
View File
@@ -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',
```
+7
View File
@@ -5,4 +5,11 @@ $if(scrollSnap)$
$else$
scrollSnap: false,
$endif$
$if(scrollProgressAuto)$
scrollProgress: 'auto',
$elseif(scrollProgress)$
scrollProgress: $scrollProgress$,
$else$
scrollProgress: false,
$endif$
$endif$