From: Vegard Nossum <vegard.nossum@oracle.com>
To: Akira Yokosawa <akiyks@gmail.com>
Cc: alexs@kernel.org, carlos.bilbao@amd.com, corbet@lwn.net,
federico.vaga@vaga.pv.it, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, siyanteng@loongson.cn,
src.res.211@gmail.com, Jani Nikula <jani.nikula@linux.intel.com>
Subject: Re: [PATCH] docs: translations: add translations links when they exist
Date: Thu, 2 Nov 2023 12:07:20 +0100 [thread overview]
Message-ID: <378b0571-a89b-43a2-8921-3f23afa0f254@oracle.com> (raw)
In-Reply-To: <0e003343-3c64-4fee-a56f-987a4ef6e336@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1856 bytes --]
On 01/11/2023 15:56, Akira Yokosawa wrote:
> It looks like this introduces hysteresis in successive runs of
> "make htmldocs" and "make latexdocs".
>
> Steps to reproduce
>
> 1. Run "make cleandocs"
>
> 2. Run "make htmldocs"
>
> 3. Run "make latexdocs"
>
> This aborts with the message (under Sphinx 7.2.6):
>
> Extension error (translations):
> Handler <function process_languages at 0x7f122f343420> for event 'doctree-resolved' threw an exception (exception: 'LaTeXBuilder' object has no attribute 'templates')
> make[2]: *** [Documentation/Makefile:128: latexdocs] Error 2
> make[1]: *** [/linux/Makefile:1695: latexdocs] Error 2
> make: *** [Makefile:234: __sub-make] Error 2
> Command exited with non-zero status 2
>
> If I run "make latexdocs" in step 2 and "make htmldocs" in step 3,
> both runs complete successfully, but html pages don't have the
> expected links to other translations.
>
> All I can do is to report the symptoms.
> Vegard, can you look into them?
Thanks for testing this out and reporting!
I think we can fix this by moving the "is this html output?" check from
the TranslationsTransform into the 'doctree-resolved' handler (which, as
far as I can tell, runs after the doctree has been serialized to disk
but before output is generated).
I've attached an incremental patch, does that seem to work for you? I
test both (clean/html/latex + clean/latex/html) and it seemed to work here.
I had a look at using a custom "visit" callback that would just render
the HTML in place instead of manipulating the doctree, but it also
doesn't feel right as then you need to specify callbacks for every
output writer; there doesn't seem to be a way to ignore the node by
default. Maybe I should ask on the Sphinx/docutils mailing lists what
the "proper" way to do this would be.
Thanks again!
Vegard
[-- Attachment #2: latexdocs-fix.patch --]
[-- Type: text/x-patch, Size: 864 bytes --]
diff --git a/Documentation/sphinx/translations.py b/Documentation/sphinx/translations.py
index 5f2866a12533..99a73075697a 100644
--- a/Documentation/sphinx/translations.py
+++ b/Documentation/sphinx/translations.py
@@ -36,9 +36,6 @@ class TranslationsTransform(Transform):
def apply(self):
app = self.document.settings.env.app
- if app.builder.format not in ['html']:
- return
-
docname = self.document.settings.env.docname
this_lang_code = None
@@ -70,6 +67,10 @@ class TranslationsTransform(Transform):
def process_languages(app, doctree, docname):
for node in doctree.traverse(LanguagesNode):
+ if app.builder.format not in ['html']:
+ node.parent.remove(node)
+ continue
+
languages = []
# Iterate over the child nodes; any resolved links will have
next prev parent reply other threads:[~2023-11-02 11:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-28 16:29 Vegard Nossum
2023-10-28 18:51 ` Vegard Nossum
2023-11-03 2:00 ` Yanteng Si
2023-10-30 11:30 ` Federico Vaga
2023-10-30 17:11 ` Jani Nikula
2023-11-01 14:56 ` Akira Yokosawa
2023-11-02 11:07 ` Vegard Nossum [this message]
2023-11-03 0:09 ` Akira Yokosawa
2023-11-17 20:54 ` 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=378b0571-a89b-43a2-8921-3f23afa0f254@oracle.com \
--to=vegard.nossum@oracle.com \
--cc=akiyks@gmail.com \
--cc=alexs@kernel.org \
--cc=carlos.bilbao@amd.com \
--cc=corbet@lwn.net \
--cc=federico.vaga@vaga.pv.it \
--cc=jani.nikula@linux.intel.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=siyanteng@loongson.cn \
--cc=src.res.211@gmail.com \
/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
all inboxes | Powered by JetHome®