Fix Pandoc 3.x compatibility issues #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🔧 修复内容
本 PR 修复了项目在 Pandoc 3.x 版本上的兼容性问题,使项目能够在最新版本的 Pandoc 上正常运行。
主要修改
Table API 兼容性修复
pandoc.Table构造函数的参数变化TableBody参数顺序:(attr, row_head_columns, head, body)TableHead和TableFoot的构造方式List 方法更新
inlines:erase(i)替换为inlines:remove(i)空值安全检查
metavalues字段添加了空值保护兼容性层
测试环境
功能验证
✅ 封面生成 (cover)
✅ 图表编号 (numbering)
✅ 章节处理 (section)
✅ 书签功能 (bookmark)
✅ 域处理 (field)
✅ 段内换行 (softbreak)
✅ 参考文献 (citeproc)
✅ 字数统计 (word_count)
生成文件
成功生成了完整的南京大学学位论文 Word 文档,所有格式和功能均正常。
向后兼容性
本修改保持了与旧版本 Pandoc 的兼容性,通过条件检查确保在不同版本的 Pandoc 上都能正常工作。
测试命令:
cd thesis pandoc --lua-filter ../src/thesis.lua --citeproc sample.md --reference-doc nju-thesis-reference.docx --output sample.docxFixes compatibility with Pandoc 3.x while maintaining backward compatibility.