summaryrefslogtreecommitdiff
path: root/Documentation/conf.py
diff options
context:
space:
mode:
authorAkira Yokosawa <akiyks@gmail.com>2022-02-01 09:04:40 +0900
committerJonathan Corbet <corbet@lwn.net>2022-02-15 16:35:54 -0700
commit5d9158e3c762f0bf1753501d8e64eb6fe19dc437 (patch)
treea9aa3c83edd4044714cf369db0c643bbba90f977 /Documentation/conf.py
parent7b686a2ea1e41e75c35ff2ec333d68b2b8c032d6 (diff)
docs/translations: Skip CJK contents if suitable fonts not found
On systems without "Noto Sans CJK" fonts, CJK chapters in translations.pdf are full of "TOFU" boxes, with a long build time and a large log file containing lots of missing-font warnings. Avoid such waste of time and resources by skipping CJK chapters when CJK fonts are not available. To skip whole chapters, change the definition of \kerneldocBegin{SC|TC|KR|JP} commands so that they can have an argument to be ignored. This works as far as the argument (#1) is not used in the command. In place of skipped contents, put a note on skipped contents at the beginning of the PDF. Change the call sites in index.rst of CJK translations accordingly. When CJK fonts are available, existing command definitions with no argument just work. LaTeX engine will see additional pairs of "{" and "}", which add a level of grouping without having any effect on typesetting. Signed-off-by: Akira Yokosawa <akiyks@gmail.com> Cc: Jonathan Corbet <corbet@lwn.net> Link: https://lore.kernel.org/r/3359ca41-b81d-b2c7-e437-7618efbe241d@gmail.com Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'Documentation/conf.py')
-rw-r--r--Documentation/conf.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/Documentation/conf.py b/Documentation/conf.py
index ded49b8e9bf6..62cd0e472b3b 100644
--- a/Documentation/conf.py
+++ b/Documentation/conf.py
@@ -563,13 +563,18 @@ latex_elements['preamble'] += '''
% Custom macros to on/off CJK (Dummy)
\\newcommand{\\kerneldocCJKon}{}
\\newcommand{\\kerneldocCJKoff}{}
- \\newcommand{\\kerneldocBeginSC}{}
+ \\newcommand{\\kerneldocBeginSC}[1]{%
+ \\begin{sphinxadmonition}{note}{Note:}
+ ``Noto Sans CJK'' fonts are not found while building this PDF\\@.
+ Translations of zh\\_CN, zh\\_TW, ko\\_KR, and ja\\_JP are
+ skipped.
+ \\end{sphinxadmonition}}
\\newcommand{\\kerneldocEndSC}{}
- \\newcommand{\\kerneldocBeginTC}{}
+ \\newcommand{\\kerneldocBeginTC}[1]{}
\\newcommand{\\kerneldocEndTC}{}
- \\newcommand{\\kerneldocBeginKR}{}
+ \\newcommand{\\kerneldocBeginKR}[1]{}
\\newcommand{\\kerneldocEndKR}{}
- \\newcommand{\\kerneldocBeginJP}{}
+ \\newcommand{\\kerneldocBeginJP}[1]{}
\\newcommand{\\kerneldocEndJP}{}
}
'''