add _extensions
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
title: Tailor Quotes for Chinese Characters in Typst
|
||||
author: Tom Ben
|
||||
version: 1.0.0
|
||||
quarto-required: ">=1.5.0"
|
||||
contributes:
|
||||
filters:
|
||||
- typst-quotes.lua
|
||||
@@ -0,0 +1,24 @@
|
||||
-- Replace Chinese corner brackets with guillemets for Typst output.
|
||||
-- The filter is run before citeproc to avoid touching bibliography
|
||||
|
||||
--- Copyright: © 2025–Present Tom Ben
|
||||
--- License: MIT License
|
||||
|
||||
function Str(el)
|
||||
if not FORMAT:match('typst') then
|
||||
return el
|
||||
end
|
||||
|
||||
local replacements = {
|
||||
['「'] = '«',
|
||||
['」'] = '»',
|
||||
['『'] = '‹',
|
||||
['』'] = '›'
|
||||
}
|
||||
|
||||
for original, replacement in pairs(replacements) do
|
||||
el.text = el.text:gsub(original, replacement)
|
||||
end
|
||||
|
||||
return el
|
||||
end
|
||||
Reference in New Issue
Block a user