EPUB: appendix chapters never get epub:type="appendix" (book-numbering.lua reads file.appendix instead of the file-metadata state)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 1/5
- 预计耗时
- 1 小时以内
- 新手友好度
- 85/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- lua, typescript
调研方向
问题出在 src/resources/filters/quarto-pre/book-numbering.lua 中 Header 处理函数的第 111 行附近,它从错误的表中读取附录标志。请将其与 common/filemetadata.lua 在状态表上设置附录标志的位置进行比较。渲染一本包含一个附录的小型 EPUB 书籍,然后检查附录章节是否带有 epub:type="appendix"。当该属性出现在输出中,且其他 EPUB 输出保持不变时,即完成。
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- JavaScript
- 星标
- 6.2k
- 派生
- 492
- 平均合并
- 15 小时 15 分钟
- 30 天内合并 PR
- 94
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
quarto-dev/quarto-cli 的其他 Issue
-
bootstrap enhancement themes
难度 2/5 1-3 小时 新手友好度 70/100
quarto-dev/quarto-cli#15421 · 2 条评论 ·
维护者通常 1 天内回复
-
accessibility bug
难度 2/5 1-3 小时 新手友好度 79/100
quarto-dev/quarto-cli#15401 · 1 个 reaction ·
维护者通常 1 天内回复
-
bug callouts docx regression
难度 2/5 1-3 小时 新手友好度 81/100
quarto-dev/quarto-cli#15394 · 2 条评论 ·
维护者通常 1 天内回复
-
bug lightbox
难度 2/5 1-3 小时 新手友好度 76/100
quarto-dev/quarto-cli#15393 ·
维护者通常 1 天内回复
-
accessibility bug website-navigation websites
难度 2/5 1-3 小时 新手友好度 75/100
quarto-dev/quarto-cli#15392 ·
维护者通常 1 天内回复
查看 quarto-dev/quarto-cli 的全部 Issue
相似的 Issue
-
bug help wanted
难度 2/5 1-3 小时 新手友好度 80/100
LangerSword/gitone#7 ·
-
good first issue reliability security should-have
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 13 天内回复
-
[BUG]: chunkSource protocol stripping truncates URLs or reads an inner scheme可能已有人在做 @Bensonbenyi 今天认领。 未关闭
难度 1/5 1 小时以内 新手友好度 88/100
Mintplex-Labs/anything-llm#7338 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复