linux-stable/Documentation/sphinx
Vegard Nossum 7418ec5b15 docs: translations: add translations links when they exist
Add a new Sphinx extension that knows about the translations of kernel
documentation and can insert links to the translations at the top of
the document.

It basically works like this:

1. Register a new node type, LanguagesNode.

2. Register a new transform, TranslationsTransform, that inserts a new
   LanguageNode at the top of every document. The LanguageNode contains
   "pending references" to translations of the document. The key here
   is that these are pending (i.e. unresolved) references that may or
   may not actually exist.

3. Register a 'doctree-resolved' event that iterates over all the
   LanguageNode nodes. Any unresolved references are filtered out; the
   list of resolved references is passed to the 'translations.html'
   template and rendered as an HTML node (if HTML output is selected).

Testing: make htmldocs, make latexdocs with Sphinx v4.3.2 and Firefox.

v2:
- changed bar into a drop-down menu
- fixed language labels
- fixed hysteresis reported by Akira Yokosawa

Cc: Federico Vaga <federico.vaga@vaga.pv.it>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Akira Yokosawa <akiyks@gmail.com>
Cc: Yanteng Si <siyanteng@loongson.cn>
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Link: https://lore.kernel.org/r/20231215123701.2712807-1-vegard.nossum@oracle.com
2023-12-19 14:34:59 -07:00
..
templates docs: translations: add translations links when they exist 2023-12-19 14:34:59 -07:00
automarkup.py docs: Raise the minimum Sphinx requirement to 2.4.4 2023-12-15 08:36:33 -07:00
cdomain.py docs: Raise the minimum Sphinx requirement to 2.4.4 2023-12-15 08:36:33 -07:00
kernel_abi.py Documentation/sphinx: fix Python string escapes 2023-09-12 14:27:45 -06:00
kernel_feat.py Documentation/sphinx: fix Python string escapes 2023-09-12 14:27:45 -06:00
kernel_include.py docs: kernel_include.py: add sphinx build dependencies 2022-03-28 13:53:46 -06:00
kerneldoc-preamble.sty docs: kerneldoc-preamble: Test xeCJK.sty before loading 2022-08-18 11:27:55 -06:00
kerneldoc.py docs/sphinx: Explicitly convert Sphinx paths to str 2023-10-10 13:35:54 -06:00
kernellog.py Move our minimum Sphinx version to 1.7 2021-02-01 16:29:12 -07:00
kfigure.py docs: Raise the minimum Sphinx requirement to 2.4.4 2023-12-15 08:36:33 -07:00
load_config.py docs: Fix the docs build with Sphinx 6.0 2023-01-06 13:04:00 -07:00
maintainers_include.py Documentation/sphinx: fix Python string escapes 2023-09-12 14:27:45 -06:00
parallel-wrapper.sh docs: Fix empty parallelism argument 2020-02-25 03:11:04 -07:00
parse-headers.pl tweewide: Fix most Shebang lines 2020-12-08 23:30:04 +09:00
requirements.txt docs: sphinx-pre-install: don't require the RTD theme 2022-10-13 11:14:43 -06:00
rstFlatTable.py docs: sphinx: Fix couple of spellings in the file rstFlatTable.py 2021-03-06 17:36:50 -07:00
translations.py docs: translations: add translations links when they exist 2023-12-19 14:34:59 -07:00