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

Đang mở
#1,320 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
lua
Lĩnh vực
documentation

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Rust
Star
316
Fork
23
Merge trung bình
11 giờ 49 phút
Pull request đã merge (30 ngày)
245

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của quarto-dev/q2

Tất cả issue của quarto-dev/q2

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.