Skip to content

Commit

Permalink
Add comments in Lua filters for Pandoc 3.2 later
Browse files Browse the repository at this point in the history
  • Loading branch information
TomBener committed May 31, 2024
1 parent 1c867f9 commit db1b940
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion _extensions/cnbib-quotes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function quotes_in_bib(block)
local next_text = i < #elements and elements[i + 1].t == "Str" and elements[i + 1].text or ""

if is_chinese(prev_text) or is_chinese(next_text) then
if FORMAT:match 'docx' then
if FORMAT:match 'docx' then -- Can be removed with Pandoc 3.2 later
elements[i] = pandoc.RawInline("openxml",
string.format(
'<w:r><w:rPr><w:rFonts w:hint="eastAsia"/></w:rPr><w:t xml:space="preserve">%s</w:t></w:r>',
Expand Down
2 changes: 2 additions & 0 deletions _extensions/docx-quotes/docx-quotes.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
--- 1. Convert straight Chinese quotes to Pandoc's Quoted elements (DoubleQuote and SingleQuote)
--- 2. Change Quoted elements to the Chinese style by adding XML tags in the docx output
--- Pandoc 3.2 later has improved support for East Asian languages in docx output, so this filter is only needed for older versions
--- https://github.com/jgm/pandoc/commit/a6c3945000ad660befac2e406b4717320282a2f8

--- Copyright: © 2024 Tom Ben
--- License: MIT License
Expand Down
2 changes: 1 addition & 1 deletion _extensions/latex-quotes/latex-quotes.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- Replaces Straight quotes with German quotes for intermediate in LaTeX output
--- Specific processing for headers to avoid issues in PDF bookmarks
--- Quarto cannot disable `smart` extension for LaTeX, so English quotes in headers are not correctly now
--- Quarto cannot disable `smart` extension for LaTeX, so English quotes in headers are not correct at the moment
--- Tracking issue: https://github.com/quarto-dev/quarto-cli/issues/7966

--- Copyright: © 2024 Tom Ben
Expand Down
5 changes: 2 additions & 3 deletions _styles/gb-author-date.csl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 不要设置 `default-locale="zh-CN"`,因为这会影响 locales,比如此时 `p. 10` 无法被 Pandoc 识别为页码,而要写作 `页 10` !!-->
<!-- initialize-with=" ": 名部分首字母缩写,initialize-with-hyphen="false": 名部分首字母缩写时不加连字符 !!-->
<!-- Remove `default-locale="zh-CN"` !!-->
<style xmlns="https://purl.org/net/xbiblio/csl" version="1.0" class="in-text" names-delimiter=". " name-as-sort-order="all" sort-separator=" " demote-non-dropping-particle="never" initialize-with=" " initialize-with-hyphen="false" page-range-format="expanded">
<info>
<title>China National Standard GB/T 7714-2015 (author-date)</title>
Expand All @@ -22,7 +21,7 @@
<category citation-format="author-date"/>
<category field="generic-base"/>
<summary>The Chinese GB/T 7714-2015 author-date style</summary>
<updated>2024-05-27 13:42:53</updated>
<updated>2024-05-29 22:34:00</updated>
<rights license="https://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>
</info>
<locale>
Expand Down
5 changes: 2 additions & 3 deletions _styles/gb-numeric.csl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 不要设置 `default-locale="zh-CN"`,因为这会影响 locales,比如此时 `p. 10` 无法被 Pandoc 识别为页码,而要写作 `页 10` !!-->
<!-- initialize-with=" ": 名部分首字母缩写,initialize-with-hyphen="false": 名部分首字母缩写时不加连字符 !!-->
<!-- Remove `default-locale="zh-CN"` !!-->
<style xmlns="https://://purl.org/net/xbiblio/csl" version="1.0" class="in-text" names-delimiter=". " name-as-sort-order="all" sort-separator=" " demote-non-dropping-particle="never" initialize-with=" " initialize-with-hyphen="false" page-range-format="expanded">
<info>
<title>China National Standard GB/T 7714-2015 (numeric)</title>
Expand All @@ -22,7 +21,7 @@
<category citation-format="numeric"/>
<category field="generic-base"/>
<summary>The Chinese GB/T 7714-2015 numeric style</summary>
<updated>2024-05-27 13:43:12</updated>
<updated>2024-05-29 22:34:16</updated>
<rights license="https://://creativecommons.org/licenses/by-sa/3.0/">This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License</rights>
</info>
<locale>
Expand Down

0 comments on commit db1b940

Please sign in to comment.