public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Akira Yokosawa <akiyks@gmail.com>
Cc: "Wu X.C." <bobwxc@email.cn>, Jonathan Corbet <corbet@lwn.net>,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] docs: Activate exCJK only in CJK chapters
Date: Tue, 25 May 2021 15:39:35 +0200	[thread overview]
Message-ID: <20210525153935.7fd9f445@coco.lan> (raw)
In-Reply-To: <97234fd1-66b8-5591-1259-6e995f91835f@gmail.com>

Em Tue, 25 May 2021 21:55:53 +0900
Akira Yokosawa <akiyks@gmail.com> escreveu:

> On Tue, 25 May 2021 20:30:12 +0800, Wu X.C. wrote:
> > On Tue, May 25, 2021 at 08:17:26PM +0900, Akira Yokosawa wrote:  
> >> Activating xeCJK in English and Italian-translation documents
> >> results in sub-optimal typesetting with wide-looking apostrophes
> >> and quotation marks.
> >>
> >> The xeCJK package provides macros for enabling and disabling its
> >> effect in the middle of a document, namely \makexeCJKactive and
> >> \makexeCJKinactive.
> >>
> >> So the goal of this change is to activate xeCJK in the relevant
> >> chapters in translations.
> >>
> >> To do this:
> >>
> >>     o Define custom macros in the preamble depending on the
> >>       availability of the "Noto Sans CJK" font so that those
> >>       macros can be used regardless of the use of xeCJK package.
> >>
> >>     o Patch \sphinxtableofcontents so that xeCJK is inactivated
> >>       after table of contents.
> >>
> >>     o Embed those custom macros in each language's index.rst file
> >>       as a ".. raw:: latex" construct.
> >>
> >> Note: A CJK chapter needs \kerneldocCJKon in front of its chapter
> >> heading, while a non-CJK chapter should have \kerneldocCJKoff
> >> below its chapter heading.
> >>
> >> This is to make sure the CJK font is available to CJK chapter's
> >> heading and ending page's footer.
> >>
> >> Signed-off-by: Akira Yokosawa <akiyks@gmail.com>  
> > 
> > Test it, worked well.
> > 
> > Tested-by: Wu XiangCheng <bobwxc@email.cn>  
> 
> Thanks!
> 
> > 
> > And one warning when am patch:
> > 
> >     .git/rebase-apply/patch:62: trailing whitespace.
> > 	    \kerneldocCJKoff  
> 
> Oops, will fix and post v3 soon, with your Tested-by: appended

You can also add:

Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

(but see below)


> 
> > 
> >   
> >> I think per-directory conf.py can be tried as a follow-up
> >> change after this patch is applied.  
> > 
> > Agree, I think it's enough for this problem.
> > If we need more complex customization, per-directory conf.py then worth. 

Well, this change seems good enough to me and it avoids the
need of adding a separate conf.py.

The only thing that concerns me is if this logic works with
all Sphinx versions. I guess it should, but there were some
changes in the past with the LaTeX output module which
broke on newer versions, as different versions of Sphinx use
different .

So, this patch needs to be tested against the minimal version recommended
for PDF output (2.4.4) and against the latest one, to be 100% sure that
it won't cause any breakages.

You can test it with something like:

	$ /usr/bin/python3 -m venv sphinx_foo
	$ . sphinx_foo/bin/activate
	$ pip install docutils Sphinx==2.4.4 sphinx_rtd_theme
	$ make pdfdocs
...
	# Should install Latest version, e. g. currently, Sphinx 4.0.2
	$ pip uninstall Sphinx
	$ pip install docutils Sphinx sphinx_rtd_theme
	$ make pdfdocs

(That's said, I didn't test version 4.0 yet... not sure if
everything would work fine, even without this change)

Regards,
Mauro

> >   
> >> --- a/Documentation/translations/index.rst
> >> +++ b/Documentation/translations/index.rst
> >> @@ -18,6 +18,10 @@ Translations
> >>  Disclaimer
> >>  ----------
> >>  
> >> +.. raw:: latex
> >> +
> >> +	\kerneldocCJKoff	
> >> +
> >>  Translation's purpose is to ease reading and understanding in languages other
> >>  than English. Its aim is to help people who do not understand English or have
> >>  doubts about its interpretation. Additionally, some people prefer to read
> >> diff --git a/Documentation/translations/it_IT/index.rst b/Documentation/translations/it_IT/index.rst
> >> index bb8fa7346939..e80a3097aa57 100644
> >> --- a/Documentation/translations/it_IT/index.rst
> >> +++ b/Documentation/translations/it_IT/index.rst
> >> @@ -4,6 +4,10 @@
> >>  Traduzione italiana
> >>  ===================
> >>  
> >> +.. raw:: latex
> >> +
> >> +	\kerneldocCJKoff
> >> +
> >>  :manutentore: Federico Vaga <federico.vaga@vaga.pv.it>
> >>  
> >>  .. _it_disclaimer:  
> > 
> > And for above two, maybe better to put "raw:: latex" block above the
> > title, more beautiful, and CJKoff will be done before enter "Italiana"
> > chapter.  
> 
> These two are placed there intentionally.
> 
> As mentioned in the change log:
> 
> >> Note: A CJK chapter needs \kerneldocCJKon in front of its chapter
> >> heading, while a non-CJK chapter should have \kerneldocCJKoff
> >> below its chapter heading.
> >>
> >> This is to make sure the CJK font is available to CJK chapter's
> >> heading and ending page's footer.  
> 
> If they are put above chapter titles in the .rst files,
> Chinese translation's final page's footer won't be rendered properly.
> 
>         Thanks, Akira
> 
> > 
> > Thanks,
> > 	Wu X.C.
> >   



Thanks,
Mauro

  reply	other threads:[~2021-05-25 13:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-22  7:28 [PATCH] docs: Activate xeCJK only in CJK chapters Akira Yokosawa
2021-05-22 16:56 ` Wu X.C.
2021-05-22 23:35   ` Akira Yokosawa
2021-05-22 18:14 ` Mauro Carvalho Chehab
2021-05-22 23:21   ` Akira Yokosawa
2021-05-25 11:17 ` [PATCH v2] docs: Activate exCJK " Akira Yokosawa
2021-05-25 12:30   ` Wu X.C.
2021-05-25 12:55     ` Akira Yokosawa
2021-05-25 13:39       ` Mauro Carvalho Chehab [this message]
2021-05-25 13:38 ` [PATCH v3] " Akira Yokosawa
2021-05-25 15:25 ` [PATCH v4] " Akira Yokosawa
2021-05-27 16:00   ` Jonathan Corbet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210525153935.7fd9f445@coco.lan \
    --to=mchehab+huawei@kernel.org \
    --cc=akiyks@gmail.com \
    --cc=bobwxc@email.cn \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox