Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable default smartquotes for zh_CN and zh_TW #12875

Merged
merged 4 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
----------
Expand Down
2 changes: 1 addition & 1 deletion sphinx/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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', ()),
}

Expand Down
26 changes: 26 additions & 0 deletions tests/test_markup/test_smartquotes.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,32 @@ def test_ja_html_builder(app):
assert '<p>-- &quot;Sphinx&quot; is a tool that makes it easy ...</p>' 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 '<p>-- &quot;Sphinx&quot; is a tool that makes it easy ...</p>' 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 '<p>-- &quot;Sphinx&quot; is a tool that makes it easy ...</p>' in content


@pytest.mark.sphinx(
'html',
testroot='smartquotes',
Expand Down