[英]pandoc lua filter to apply Emphasis character style to Emph elements when converting to docx
[英]pandoc lua filter to apply Quotations style to a Div when converting to docx
我正在使用 pandoc 從 latex 轉換為 docx。 在 pandoc AST 中,latex \quoting 環境由一個 Div 表示,如下所示:
, Div
( "" , [ "quoting" ] , [] )
[ Para
[ Str
"\26377\38065\23601\20986"
]
]
但是,在寫出 docx 文件時會忽略這一點。 如何使用 lua 過濾器將參考 docx 文件中已定義的引用樣式應用於此 Div 的內容? 我已經閱讀了所有文檔,但仍然缺乏自己編寫過濾器的必要信息和技能。 任何幫助將不勝感激。
如果樣式是通過custom-style
屬性傳遞的,則 docx 編寫器將使用樣式。 所以像這樣的過濾器應該可以工作:
function Div (div)
if div.classes:includes 'quoting' then
div.attributes['custom-style'] = 'Quotations'
return div
end
end
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.