linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vegard Nossum <vegard.nossum@oracle.com>
To: Akira Yokosawa <akiyks@gmail.com>
Cc: linux-doc@vger.kernel.org, Jonathan Corbet <corbet@lwn.net>
Subject: Re: docs: "translations" extension breaks "make latexdocs" with 6.1.3<=Sphinx<7.2
Date: Mon, 12 Feb 2024 11:28:40 +0100	[thread overview]
Message-ID: <37ecca9e-83f9-4f91-9b76-b5bd012dc3ee@oracle.com> (raw)
In-Reply-To: <54a56c2e-a27c-45a0-b712-02a7bc7d2673@gmail.com>


On 12/02/2024 10:52, Akira Yokosawa wrote:
> Hi Vegard,
> 
> While testing update of sphinx_pre_install WRT pyyaml, I noticed build
> errors in "make latexdocs" against Fedora 39's distro Sphinx (v6.2.1).
> 
> I don't mean the translations extension is doing anything wrong.
> 
> Repro:
> 
>      make cleandocs
>      make SPHINXDIRS=doc-guide htmldocs  # for yaml -> rst conversion
>      make SPHINXDIRS=doc-guide latexdocs
> 
> At current docs-next, Fedora 39's Sphinx ends up in the error:
> 
>      Exception occurred:
>        File "/usr/lib/python3.12/site-packages/sphinx/util/nodes.py", line 624, in _copy_except__document
>          newnode = self.__class__(rawsource=self.rawsource, **self.attributes)
>                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>      TypeError: LanguagesNode.__init__() missing 1 required positional argument: 'current_language'
>      The full traceback has been saved in /tmp/sphinx-err-7xmwytuu.log, if you want to report the issue to the developers.

Thanks, with all your info it was quick and easy to reproduce.

I think we can solve it by making 'current_language' a true element
attribute:

diff --git a/Documentation/sphinx/translations.py 
b/Documentation/sphinx/translations.py
index 47161e6eba99..f20c30599ceb 100644
--- a/Documentation/sphinx/translations.py
+++ b/Documentation/sphinx/translations.py
@@ -32,7 +32,7 @@ class LanguagesNode(nodes.Element):
      def __init__(self, current_language, *args, **kwargs):
          super().__init__(*args, **kwargs)

-        self.current_language = current_language
+        self['current_language'] = current_language

  class TranslationsTransform(Transform):
      default_priority = 900
@@ -84,7 +84,7 @@ def process_languages(app, doctree, docname):

          html_content = app.builder.templates.render('translations.html',
              context={
-                'current_language': node.current_language,
+                'current_language': node['current_language'],
                  'languages': languages,
              })

This is probably more correct anyway.

I'll test this more thoroughly with a full build as I think translations
won't show up when using SPHINXDIRS= (because the translation is outside
the source tree) as well as with older/newer Sphinx versions.

Thanks,


Vegard

  reply	other threads:[~2024-02-12 10:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-12  9:52 docs: "translations" extension breaks "make latexdocs" with 6.1.3<=Sphinx<7.2 Akira Yokosawa
2024-02-12 10:28 ` Vegard Nossum [this message]
2024-02-12 12:26   ` Vegard Nossum
2024-02-12 21:52     ` Jonathan Corbet
2024-02-12 22:04       ` Vegard Nossum
2024-02-13  9:33         ` Jani Nikula
2024-02-13 14:34           ` 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=37ecca9e-83f9-4f91-9b76-b5bd012dc3ee@oracle.com \
    --to=vegard.nossum@oracle.com \
    --cc=akiyks@gmail.com \
    --cc=corbet@lwn.net \
    --cc=linux-doc@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;
as well as URLs for NNTP newsgroup(s).