quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.74k stars 305 forks source link

revealjs title slide partial #10308

Closed kbvernon closed 1 week ago

kbvernon commented 1 month ago

Bug description

If I use the default template-partial for the title slide in a revealjs presentation but make no changes to the template-partial, shouldn't it have the same formatting as a presentation that doesn't use the template-partial at all?

Steps to reproduce

test-with-partial.qmd

---
title: "Critical Role"
subtitle: "Nerdy Ass Voice Actors Playing DnD"
author: 
  - name: Nott the Brave
    affiliation: The Mighty Nein
    orcid: 0000-0002-1825-0097
  - name: Fresh Cut Grass
    affiliation: Bells' Hells
    orcid: 0000-0002-1825-0097
date: last-modified
format:
  revealjs:
    template-partials:
      - title-slide.html
---

title-slide.html

<section id="$idprefix$title-slide"$for(title-slide-attributes/pairs)$ $it.key$="$it.value$"$endfor$>
  <h1 class="title">$title$</h1>
$if(subtitle)$
  <p class="subtitle">$subtitle$</p>
$endif$
$for(author)$
  <p class="author">$author$</p>
$endfor$
$for(institute)$
  <p class="institute">$institute$</p>
$endfor$
$if(date)$
  <p class="date">$date$</p>
$endif$
</section>

Expected behavior

I would expect these to produce the same output as

test-without-partial.qmd

---
title: "Critical Role"
subtitle: "Nerdy Ass Voice Actors Playing DnD"
author: 
  - name: Nott the Brave
    affiliation: The Mighty Nein
    orcid: 0000-0002-1825-0097
  - name: Fresh Cut Grass
    affiliation: Bells' Hells
    orcid: 0000-0002-1825-0097
date: last-modified
format: revealjs
---

Actual behavior

Yaml options author.orcid and author.affiliation get dropped and formatting is removed.

Your environment

Matrix products: default

locale: [1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8
[3] LC_MONETARY=English_United States.utf8 LC_NUMERIC=C
[5] LC_TIME=English_United States.utf8

time zone: America/Denver tzcode source: internal

attached base packages: [1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached): [1] compiler_4.3.1 tools_4.3.1


### Quarto check output

```bash
$ quarto check
Quarto 1.4.545
[>] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.11: OK
      Dart Sass version 1.69.5: OK
      Deno version 1.37.2: OK
[>] Checking versions of quarto dependencies......OK
[>] Checking Quarto installation......OK
      Version: 1.4.545
      Path: C:\Program Files\Quarto\bin
      CodePage: 1252

[>] Checking tools....................OK
      TinyTeX: v2023.01
      Chromium: (not installed)

[>] Checking LaTeX....................OK
      Using: TinyTex
      Path: C:\Users\kenne\AppData\Roaming\TinyTeX\bin\win32\
      Version: 2022

[>] Checking basic markdown render....OK

[>] Checking Python 3 installation....OK
      Version: 3.11.4
      Path: C:/Users/kenne/AppData/Local/Programs/Python/Python311/python.exe
      Jupyter: (None)

      Jupyter is not available in this Python installation.
      Install with py -m pip install jupyter

[>] Checking R installation...........OK
      Version: 4.3.1
      Path: C:/PROGRA~1/R/R-43~1.1
      LibPaths:
        - C:/Users/kenne/AppData/Local/R/win-library/4.3
        - C:/Program Files/R/R-4.3.1/library
      knitr: 1.47
      rmarkdown: 2.27

[>] Checking Knitr engine render......OK
kbvernon commented 1 month ago

For reference, I was hoping to add

github: kbvernon/my-revealjs-repo

to the yaml and then this to title-slide.html

$if(github)$
    <p>GitHub: <a href="https://github.com/$github$">$github$</a></p>
$endif$

on the assumption that there's not a better way to do this...

cderv commented 1 month ago

If I use the default template-partial for the title slide in a revealjs presentation but make no changes to the template-partial, shouldn't it have the same formatting as a presentation that doesn't use the template-partial at all?

It should, but you need to use the right title-slide partial. Since Quarto 1.2, where this partial has been introduced, Quarto is using an improved version of title slide partials. So the exact one to provide would be

The one you provided explicitely is the default pandoc title slide

That is why you get a difference.

The usual one from Pandoc can be opt-in by title-slide-style: pandoc (See https://quarto.org/docs/reference/formats/presentations/revealjs.html#slides)

So if you do

---
title: "Critical Role"
subtitle: "Nerdy Ass Voice Actors Playing DnD"
author: 
  - name: Nott the Brave
    affiliation: The Mighty Nein
    orcid: 0000-0002-1825-0097
  - name: Fresh Cut Grass
    affiliation: Bells' Hells
    orcid: 0000-0002-1825-0097
date: last-modified
format: 
    revealjs:
        title-slide-style: pandoc
---

I believe you will get the same output.

then this to title-slide.html

You would need to provide a copy of this partial modified (https://github.com/quarto-dev/quarto-cli/blob/main/src/resources/formats/revealjs/pandoc/title-fancy/title-slide.html) and it would work as you expect.

I'll see where we can add more about this in our documentation. Probably at: https://quarto.org/docs/journals/templates.html#revealjs-partials and Custom Template

and then we'll make that more clear after this has been done

kbvernon commented 1 month ago

This is super helpful, as always. Thanks, @cderv!

Should I leave this open for now?

mcanouil commented 1 month ago

@kbvernon Yes, we'll keep this until the documentation clarifies the partial used in this case. Thanks again for the report!