EPUB: appendix chapters never get epub:type="appendix" (book-numbering.lua reads file.appendix instead of the file-metadata state)
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ó
- 1/5
- Thời gian dự kiến
- Dưới một giờ
- Mức phù hợp với người mới
- 85/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- lua, typescript
- Lĩnh vực
- documentation
Hướng nghiên cứu
Lỗi nằm ở trình xử lý Header trong src/resources/filters/quarto-pre/book-numbering.lua, khoảng dòng 111, nơi đọc cờ phụ lục từ sai bảng. Hãy so sánh với chỗ common/filemetadata.lua đặt cờ phụ lục trên bảng trạng thái. Hãy render một cuốn sách EPUB nhỏ có một phụ lục, rồi kiểm tra xem phần phụ lục có nhận được epub:type="appendix" hay không. Công việc hoàn thành khi thuộc tính này xuất hiện trong đầu ra và phần đầu ra EPUB còn lại không thay đổi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
In an EPUB book, appendix chapters never get epub:type="appendix", although src/resources/filters/quarto-pre/book-numbering.lua has a rule meant to add it.
Cause
The rule reads the wrong table. In the Header handler (quarto-pre/book-numbering.lua, line 111 on main at cda410214):
local file = currentFileMetadataState().file
...
-- mark appendix chapters for epub
if el.level == 1 and _quarto.format.isEpubOutput() then
if file.appendix == true and bookItemType == "chapter" then
el.attr.attributes["epub:type"] = "appendix"
end
end
file is the decoded per-item JSON that bookItemMetadata in src/project/types/book/book-render.ts writes (resourceDir, bookItemType, bookItemNumber, bookItemFile, bookItemDepth). It has no appendix field, so file.appendix is always nil and the branch is dead.
The flag the rule wants exists, but on the state table: common/filemetadata.lua sets fileMetadataState.appendix = true when it parses the item whose bookItemType is "appendix" (the appendix divider), and appendix chapters are typed "chapter". So the correct read is currentFileMetadataState().appendix.
Reproduction
_quarto.yml:
project:
type: book
book:
title: "Appendix repro"
author: "x"
chapters:
- index.qmd
- intro.qmd
appendices:
- appendix-a.qmd
format:
epub: default
index.qmd is # Preface {.unnumbered}, intro.qmd is # Intro, and appendix-a.qmd is # Extra material, each with a line of body text. Run quarto render --to epub, unzip the result and search for epub:type="appendix".
- Observed (dev build with the filters of v1.11.6, and the same code is on
main): no match. - With only line 111 changed to
if currentFileMetadataState().appendix == true and bookItemType == "chapter" then: exactly one match,<section id="extra-material" class="level1" epub:type="appendix">, and no other change to the output.
I searched existing issues for this (queries on epub:type, appendix and epub, bookItemMetadata) and found nothing; #14616 is about the PDF appendix heading, a different problem.
Fix
The one-line change above. It changes EPUB output (appendix chapters gain the semantic attribute), which is the behavior the rule was written for.
Context
Found while working on quarto-dev/quarto-pandoc-resources, a shared home for these filters. The fix will be carried there. If quarto-cli adopts that repository, this issue is fixed by the move; until then it can also be fixed here directly.
- Ngôn ngữ chính
- JavaScript
- Star
- 6.2k
- Fork
- 492
- Merge trung bình
- 15 giờ 15 phút
- Pull request đã merge (30 ngày)
- 94
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của quarto-dev/quarto-cli
-
bootstrap enhancement themes
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
quarto-dev/quarto-cli#15421 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
accessibility bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
quarto-dev/quarto-cli#15401 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug callouts docx regression
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 81/100
quarto-dev/quarto-cli#15394 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug lightbox
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
quarto-dev/quarto-cli#15393 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
accessibility bug website-navigation websites
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
quarto-dev/quarto-cli#15392 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của quarto-dev/quarto-cli
Issue tương tự
-
bug help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
LangerSword/gitone#7 ·
-
good first issue reliability security should-have
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 13 ngày
-
[BUG]: chunkSource protocol stripping truncates URLs or reads an inner schemeCó thể đã có người làm @Bensonbenyi đã nhận hôm nay. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Mintplex-Labs/anything-llm#7338 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày