quarto-dev / quarto-dev/quarto-cli

(meta) Shortcode for PDF books needs to evaluate on a per document basis

Open
#6,532 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

books bug latex shortcodes
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Description

From https://github.com/christophevx/TestQuartoForm, it appears the meta shortcode in PDF book format is evaluated on the combined document which means only metadata from index.qmd are read and it is not possible to use chapters metadata.

It seems to be an issue with the order of evaluation of the shortcode and the concatenation of the Quarto documents into the tex file.

Discussed in https://github.com/quarto-dev/quarto-cli/discussions/6497

Originally posted by christophevx August 11, 2023

Description

Metadata Quarto issue or Pandoc Issue ? Or as-designed ?

I am in a Quarto book project.

I would like to have the first part globalized for each chapter, but I don't want to write all everytime, so I made an include file (recap.qmd in my example).

I tested a lot of way to do that, but I am not able to include metadata values of the document in the render.

  • Root folder
    • 01 - First part
      • 01 - First chapter.qmd
      • 02 - Second chapter.qmd
    • 02 - Second Part
      • 01 - First chapter.qmd
      • 02 - Second chapter.qmd
    • _includes
      • recap.qmd
    • _quarto.yml

Here is my _quarto.yml

book:
  author: An author
  chapters:
  - index.qmd
  - chapters:
    - "01 - First part/01 - First chapter.qmd"
    - "01 - First part/02 - Second chapter.qmd"
    part: "Introduction"
  - chapters:
    - "02 - Second Part/01 - First chapter.qmd"
    - "02 - Second Part/02 - Second chapter.qmd"
    part: "Another thing"
  date: 26/07/2023
  title: "What I want to do"
format:
  pdf:
    documentclass: book
    fontsize: 12pt
    header-includes:
    - \makeatletter
    - \@addtoreset{chapter}{part}
    - \makeatother
    mainfont: Imprima-Regular.ttf
    papersize: A4
    sansfont: Voces-Regular.ttf
project:
  output-dir: _book
  type: book

Here is my recap.qmd file

Duration: {{< meta duration >}} minutes

Here is one of chapter file :

---
title: "Title of the chapter"
duration: 4
type: V
---

In document : {{< meta duration >}} ==> Doesn't work

{{< include ../_includes/recap.qmd >}} ==> Doesn't work

The error I have when I render the project is : "WARNING: Unknown meta key duration specified in a metadata Shortcode"

I made the render with the simple command "quarto render --debug"

Can you tell me if if is a Quarto issue, a Pandoc issue or a "as-designed" feature ?

Or if I'm totally wrong with all of this ?

Thank you in advance.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked TestQuartoForm reproduction, including _quarto.yml, index.qmd, the chapter files, and _includes/recap.qmd; run quarto render --debug to observe the metadata shortcode warning. Trace how PDF book documents are concatenated and how the duration metadata shortcode is evaluated. Done means chapter metadata is available when each document's shortcode is rendered, including through the include file.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.