From 6b5b9d41b8cbd193f523a9e4cc829050a2dd8780 Mon Sep 17 00:00:00 2001 From: khanxmetu Date: Mon, 9 Sep 2024 14:12:06 +0300 Subject: [PATCH 1/2] Closes #12874: Disable default smartquotes for zh_CN and zh_TW --- sphinx/config.py | 2 +- tests/test_markup/test_smartquotes.py | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/sphinx/config.py b/sphinx/config.py index bae92140d59..0fd2102e732 100644 --- a/sphinx/config.py +++ b/sphinx/config.py @@ -271,7 +271,7 @@ class Config: 'smartquotes': _Opt(True, 'env', ()), 'smartquotes_action': _Opt('qDe', 'env', ()), 'smartquotes_excludes': _Opt( - {'languages': ['ja'], 'builders': ['man', 'text']}, 'env', ()), + {'languages': ['ja', 'zh_CN', 'zh_TW'], 'builders': ['man', 'text']}, 'env', ()), 'option_emphasise_placeholders': _Opt(False, 'env', ()), } diff --git a/tests/test_markup/test_smartquotes.py b/tests/test_markup/test_smartquotes.py index e9ee9f3c7ac..b57a8a81017 100644 --- a/tests/test_markup/test_smartquotes.py +++ b/tests/test_markup/test_smartquotes.py @@ -86,6 +86,32 @@ def test_ja_html_builder(app): assert '

-- "Sphinx" is a tool that makes it easy ...

' in content +@pytest.mark.sphinx( + 'html', + testroot='smartquotes', + freshenv=True, + confoverrides={'language': 'zh_CN'}, +) +def test_zh_cn_html_builder(app): + app.build() + + content = (app.outdir / 'index.html').read_text(encoding='utf8') + assert '

-- "Sphinx" is a tool that makes it easy ...

' in content + + +@pytest.mark.sphinx( + 'html', + testroot='smartquotes', + freshenv=True, + confoverrides={'language': 'zh_TW'}, +) +def test_zh_tw_html_builder(app): + app.build() + + content = (app.outdir / 'index.html').read_text(encoding='utf8') + assert '

-- "Sphinx" is a tool that makes it easy ...

' in content + + @pytest.mark.sphinx( 'html', testroot='smartquotes', From ff7b0bb0bd008114a623136588bb7a67a22e20b2 Mon Sep 17 00:00:00 2001 From: khanxmetu Date: Thu, 26 Sep 2024 22:25:32 +0300 Subject: [PATCH 2/2] Add CHANGELOG entry --- CHANGES.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.rst b/CHANGES.rst index 3d5d3913326..1a7482024bf 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -17,6 +17,7 @@ Incompatible changes Code-blokcs are unchanged as FreeMono is now loaded with ``Scale=0.9``. An adjustement to existing projects is needed only if they used a custom :ref:`fontpkg` configuration and did not set :ref:`fvset`. +* #12875: Disable smartquotes for languages: ``zh_CN`` and ``zh_TW`` by default. Deprecated ----------