Thanks to visit codestin.com
Credit goes to github.com

Skip to content

引用符から鉤括弧への変換に不具合がある #774

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

Closed
cocoatomo opened this issue Oct 12, 2017 · 6 comments
Closed

引用符から鉤括弧への変換に不具合がある #774

cocoatomo opened this issue Oct 12, 2017 · 6 comments
Assignees

Comments

@cocoatomo
Copy link
Contributor

ref. sphinx-doc/sphinx#4142

HTML へのビルドを行うと、この訳文 (https://github.com/python-doc-ja/py36-locale/blob/master/ja/LC_MESSAGES/bugs.po#L122) に含まれる "Title"」Title」 に変換されるという不具合がある。
#771 のと類似の事象だが、こちらは段落の文字列なので Sphinx 1.6.4 でも smart quotes による変換対象となってしまう。

@cocoatomo
Copy link
Contributor Author

cocoatomo commented Oct 14, 2017

日本語で smart quotes を使うのは問題があるので、この機能を無効にすることで対応するつもりでいる。

具体的には、Sphinx プロジェクトのルートディレクトリに次の内容を含む docutils.conf ファイルを設置する。

[restructuredtext parser]
smart_quotes:no

ref. http://docutils.sourceforge.net/docs/user/config.html#smart-quotes

ただし、smart quotes を無効にすると、引用符 (", ') 以外にも ---, --, ... が変換されず、そのまま出力されるようになる。

@cocoatomo
Copy link
Contributor Author

@methane 対応方法について問題無いか確認してもらえますか?

@methane
Copy link
Contributor

methane commented Oct 15, 2017

これ、同じディレクトリで複数言語をビルドしている場合に、日本語だけで smart_quotes:no する方法はありますか?

@cocoatomo
Copy link
Contributor Author

cocoatomo commented Oct 15, 2017

方法が1つ見付かりました。

docutils.conf に書けるオプションとして smartquotes_locales があり、ここには引用符の置き換えに使う文字列が言語ごとに指摘できます。
http://docutils.sourceforge.net/docs/user/smartquotes.html#smartquotes-locales

docutils.conf に以下の内容を記述して、日本語で引用符の置き換えに使う文字を ""'' (二重引用符、二重引用符、単引用符、単引用符) に設定すれば、実質的に変換しない動作が実現できます。

[restructuredtext parser]
smartquotes_locales: ja: ""''

これは括弧についてだけの設定なので、 ---, --, ... には smart quotes による変換がかかります。
(smart_quotes:no とするよりもこちらの方が良いと思います。)

実験結果

repository URL: https://github.com/python-doc-ja/cpython-doc-intl.git
commit hash: 87caf1ccad1457387bec57579fc742af3f2b703b
OS: macOS 10.13
Python ver.: 3.6.3
Sphinx ver.: 1.6.4
docutils ver.: 0.14
.po ファイルは日本語のみ用意。

日本語、smart quotes 有効、docutils.conf 無し

ビルドコマンド: sphinx-build -j4 -D language=ja -D locale_dirs=locale -D gettext_compact=0 -A versionswitcher=1 -E -d build/doctrees . ./_build/html

画面キャプチャ

screen shot 2017-10-15 at 15 35 29

フランス語、smart quotes 有効、docutils.conf 無し

ビルドコマンド: sphinx-build -j4 -D language=fr -D locale_dirs=locale -D gettext_compact=0 -A versionswitcher=1 -E -d build/doctrees . ./_build/html-fr

画面キャプチャ

screen shot 2017-10-15 at 15 39 28

日本語、smart quotes 有効、docutils.conf 有

ビルドコマンド: sphinx-build -j4 -D language=ja -D locale_dirs=locale -D gettext_compact=0 -A versionswitcher=1 -E -d build/doctrees . ./_build/html-conf

画面キャプチャ

screen shot 2017-10-15 at 15 41 47

フランス語、smart quotes 有効、docutils.conf 有

ビルドコマンド: sphinx-build -j4 -D language=fr -D locale_dirs=locale -D gettext_compact=0 -A versionswitcher=1 -E -d build/doctrees . ./_build/html-fr-conf

画面キャプチャ

screen shot 2017-10-15 at 15 42 45

@JulienPalard
Copy link

Opened a PR on cpython after a full test build: python/cpython#4006

cocoatomo added a commit to python-doc-ja/cpython-doc-intl that referenced this issue Oct 18, 2017
cocoatomo added a commit to python-doc-ja/cpython-doc-intl that referenced this issue Oct 18, 2017
@cocoatomo
Copy link
Contributor Author

問題が全て解決したのでクローズ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants