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

Sphinx fails to distinguish open and close quotation marks #4142

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

Sphinx fails to distinguish open and close quotation marks #4142

cocoatomo opened this issue Oct 12, 2017 · 5 comments

Comments

@cocoatomo
Copy link
Contributor

cocoatomo commented Oct 12, 2017

Subject: On the translation project of Python document, smart quotes, the feature from docutils, fails to determine whether some quotation mark is open or close.

Problem

  • docutils transforms "Title" to ”Title” (&#8221, T, i, t, l, e, &#8221), or 」Title」 with smart quotes enabled and language set to Japanese.

Procedure to reproduce the problem

git clone https://github.com/python-doc-ja/cpython-doc-intl.git
cd cpython-doc-intl
git checkout 87caf1ccad1457387bec57579fc742af3f2b703b

git clone https://github.com/python-doc-ja/py36-locale.git ./Doc/locale
cd ./Doc/locale
git checkout 6f42a6b453026fff60e18da1a1900a9db9593cfb

cd ..
sphinx-build -j4 -D language=ja -D locale_dirs=locale -D gettext_compact=0 -A versionswitcher=1 -E -d build/doctrees . ./_build/html

Then, open _build/html/bugs.html with your browser.

Error logs / results

screen shot 2017-10-12 at 11 30 30

Expected results

docutils transforms "Title" to 「Title」 (also "Type" to 「Type」),
or do not transforms "Title" at all.

Reproducible project / your project

Environment info

  • OS: macOS 10.13
  • Python version: 3.6.2
  • Sphinx version: 1.6.4
@jfbu
Copy link
Contributor

jfbu commented Oct 22, 2017

I can reproduce it with Docutils.

Test file index.rst:

.. comment
   https://github.com/python-doc-ja/py36-locale/blob/master/ja/LC_MESSAGES/bugs.po#L122

.. comment https://github.com/sphinx-doc/sphinx/issues/4142

Welcome to FOO's documentation!
===============================

Hello \"Title\" World

バグ報告フォームには幾つかのフィールドがあります。\"Title\" フィールドには、問題の説明を *非常に*

Process with rst2html.py --language "ja" --smart-quotes "on" index.rst test.html.

html file contains:

<p>Hello 「Title」 World</p>
<p>バグ報告フォームには幾つかのフィールドがあります。」Title」 フィールドには、問題の説明を <em>非常に</em></p>

Can you open ticket or ask for advice/explanation at https://sourceforge.net/p/docutils/bugs ?

@cocoatomo
Copy link
Contributor Author

@jfbu OK, I will open a ticket and give an explanation later.
Thank you for the advice and the reproducible sample.

@cocoatomo
Copy link
Contributor Author

I just have created a ticket.

Ticket URL: https://sourceforge.net/p/docutils/bugs/332/

@tk0miya
Copy link
Member

tk0miya commented Oct 26, 2017

I confirmed. Indeed, docutils expects a space before opening quotes.
So it can't use for CJK documents because they does not use spaces between words. AFAIK, a tokenizer is needed to do that.
So it should be disabled for these languages by default, I believe.

tk0miya added a commit that referenced this issue Nov 1, 2017
jfbu added a commit to jfbu/sphinx that referenced this issue Dec 30, 2017
jfbu added a commit to jfbu/sphinx that referenced this issue Jan 5, 2018
closes sphinx-doc#4142
closes sphinx-doc#4357
closes sphinx-doc#4359
refs: sphinx-doc#3967

Adds ``smartquotes``, ``smartquotes_action``, ``smartquotes_excludes``
configuration variables.

- if ``smartquotes`` is set to False, then Smart Quotes transform is not
  applied even if a Docutils configuration file activates it,

- the current default of ``smartquotes_excludes`` deactivates Smart
  Quotes for Japanese language, and also for the ``man`` and ``text``
  builders.

  However, currently ``make text html`` deactivates Smart Quotes for
  ``html`` too, and ``make html text`` activates them for ``text`` too,
  because the picked environment is shared and already transformed.

- now Smart Quotes get applied also when source documents are in
  Markdown or other formats.
@jfbu
Copy link
Contributor

jfbu commented Jan 6, 2018

Closing because bd13945 disables Smart Quotes for Japanese (refs: #4360; Sphinx 1.6.6)

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

No branches or pull requests

3 participants