diff options
Diffstat (limited to 'Documentation/conf.py')
-rw-r--r-- | Documentation/conf.py | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/Documentation/conf.py b/Documentation/conf.py index 3b2397bcb565..a8fe845832bc 100644 --- a/Documentation/conf.py +++ b/Documentation/conf.py | |||
@@ -16,6 +16,8 @@ import sys | |||
16 | import os | 16 | import os |
17 | import sphinx | 17 | import sphinx |
18 | 18 | ||
19 | from subprocess import check_output | ||
20 | |||
19 | # Get Sphinx version | 21 | # Get Sphinx version |
20 | major, minor, patch = sphinx.version_info[:3] | 22 | major, minor, patch = sphinx.version_info[:3] |
21 | 23 | ||
@@ -276,10 +278,21 @@ latex_elements = { | |||
276 | \\setsansfont{DejaVu Sans} | 278 | \\setsansfont{DejaVu Sans} |
277 | \\setromanfont{DejaVu Serif} | 279 | \\setromanfont{DejaVu Serif} |
278 | \\setmonofont{DejaVu Sans Mono} | 280 | \\setmonofont{DejaVu Sans Mono} |
279 | |||
280 | ''' | 281 | ''' |
281 | } | 282 | } |
282 | 283 | ||
284 | # At least one book (translations) may have Asian characters | ||
285 | # with are only displayed if xeCJK is used | ||
286 | |||
287 | cjk_cmd = check_output(['fc-list', '--format="%{family[0]}\n"']).decode('utf-8', 'ignore') | ||
288 | if cjk_cmd.find("Noto Sans CJK SC") >= 0: | ||
289 | print ("enabling CJK for LaTeX builder") | ||
290 | latex_elements['preamble'] += ''' | ||
291 | % This is needed for translations | ||
292 | \\usepackage{xeCJK} | ||
293 | \\setCJKmainfont{Noto Sans CJK SC} | ||
294 | ''' | ||
295 | |||
283 | # Fix reference escape troubles with Sphinx 1.4.x | 296 | # Fix reference escape troubles with Sphinx 1.4.x |
284 | if major == 1 and minor > 3: | 297 | if major == 1 and minor > 3: |
285 | latex_elements['preamble'] += '\\renewcommand*{\\DUrole}[2]{ #2 }\n' | 298 | latex_elements['preamble'] += '\\renewcommand*{\\DUrole}[2]{ #2 }\n' |
@@ -410,6 +423,21 @@ latex_documents = [ | |||
410 | 'The kernel development community', 'manual'), | 423 | 'The kernel development community', 'manual'), |
411 | ] | 424 | ] |
412 | 425 | ||
426 | # Add all other index files from Documentation/ subdirectories | ||
427 | for fn in os.listdir('.'): | ||
428 | doc = os.path.join(fn, "index") | ||
429 | if os.path.exists(doc + ".rst"): | ||
430 | has = False | ||
431 | for l in latex_documents: | ||
432 | if l[0] == doc: | ||
433 | has = True | ||
434 | break | ||
435 | if not has: | ||
436 | latex_documents.append((doc, fn + '.tex', | ||
437 | 'Linux %s Documentation' % fn.capitalize(), | ||
438 | 'The kernel development community', | ||
439 | 'manual')) | ||
440 | |||
413 | # The name of an image file (relative to this directory) to place at the top of | 441 | # The name of an image file (relative to this directory) to place at the top of |
414 | # the title page. | 442 | # the title page. |
415 | #latex_logo = None | 443 | #latex_logo = None |