Lua: for docx output, filters after `quarto` see a different environment

Aperta
#1,320 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
lua
Ambito
documentation

Direzione di ricerca

The bug sits in how filters listed after quarto in the filters: key are run inside pandoc for docx output, so start with the Lua filter runner and the code that sets PANDOC_VERSION and quarto.version for each filter. Reproduce with the ver.lua and ver.qmd snippets from the issue and compare the stderr and document output at each position. Done means both positions report the same PANDOC_VERSION and quarto.version and stderr from post filters is visible.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Tested with q2 0.47.0 and pandoc 3.14 (via QUARTO_PANDOC) on Windows 11, compared with Quarto 1.11.9 and plain pandoc 3.14.

For docx (and the other formats where post filters run inside pandoc), the same filter behaves differently depending on where it is in filters::

before quarto (and all filters for HTML) after quarto, docx
PANDOC_VERSION 3.0.0 3.14 (the real pandoc)
quarto.version 0.47.0 0
print / io.stderr:write shown dropped, unless the line starts with [WARNING] (then shown as Q-11-1)

Repro

ver.lua:

function Pandoc(doc)
  io.stderr:write("hello\n")
  doc.blocks:insert(pandoc.Para(pandoc.Str(
    "V=" .. tostring(PANDOC_VERSION) .. ",quarto=" .. tostring(quarto.version))))
  return doc
end
---
filters: [ver.lua, quarto, ver.lua]
---

X.

q2 render ver.qmd --to docx

Actual: "hello" is printed once; the document has V=3.0.0,quarto=0.47.0 and V=3.14,quarto=0.

Expected: the same values in both positions. PANDOC_VERSION 3.0.0 is a problem in its own right: filters and extensions that check PANDOC_VERSION >= "3.1" to pick a code path take the wrong one. Losing stderr makes post filters hard to debug.

Lingua principale
Rust
Stelle
316
Fork
23
Merge medio
11h 49m
PR unite (30g)
245

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di quarto-dev/q2

Tutte le issue di quarto-dev/q2

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.