summaryrefslogtreecommitdiffstats
path: root/Documentation/conf.py
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@s-opensource.com>2017-09-03 15:12:46 -0400
committerJonathan Corbet <corbet@lwn.net>2017-09-08 12:02:44 -0400
commit9fdcd6afd8990889aeebcfa93ef79b402cdeb8a3 (patch)
treeb7d6998c063989f169017568905ccd3b7e0e74f0 /Documentation/conf.py
parentc4b326e1a6b40ee403d37acd1363ade36e9b6fbe (diff)
docs-rst: conf.py: only setup notice box colors if Sphinx < 1.6
Sphinx 1.5 added a new way to change backward colors for note boxes, but kept backward compatibility with 1.4. On Sphinx 1.6, the old way stopped working, in favor of a new less hackish way. Unfortunately, this is currently too buggy to be used, and the old way doesn't work anymore. So, we have no option but to stick with boring notice boxes. One example of such bug is the notice that it is inside struct v4l2_plane, at the "bytesused" field. At least, add a notice about how to use, as maybe some day the bug will vanish. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'Documentation/conf.py')
-rw-r--r--Documentation/conf.py62
1 files changed, 43 insertions, 19 deletions
diff --git a/Documentation/conf.py b/Documentation/conf.py
index 38a606b07285..b986eda20a05 100644
--- a/Documentation/conf.py
+++ b/Documentation/conf.py
@@ -271,6 +271,31 @@ latex_elements = {
271 271
272# Additional stuff for the LaTeX preamble. 272# Additional stuff for the LaTeX preamble.
273 'preamble': ''' 273 'preamble': '''
274 % Use some font with UTF-8 support with XeLaTeX
275 \\usepackage{fontspec}
276 \\setsansfont{DejaVu Serif}
277 \\setromanfont{DejaVu Sans}
278 \\setmonofont{DejaVu Sans Mono}
279
280 % To allow adjusting table sizes
281 \\usepackage{adjustbox}
282
283 '''
284}
285
286# Fix reference escape troubles with Sphinx 1.4.x
287if major == 1 and minor > 3:
288 latex_elements['preamble'] += '\\renewcommand*{\\DUrole}[2]{ #2 }\n'
289
290if major == 1 and minor <= 4:
291 latex_elements['preamble'] += '\\usepackage[margin=0.5in, top=1in, bottom=1in]{geometry}'
292elif major == 1 and (minor > 5 or (minor == 5 and patch >= 3)):
293 latex_elements['sphinxsetup'] = 'hmargin=0.5in, vmargin=1in'
294 latex_elements['preamble'] += '\\fvset{fontsize=auto}\n'
295
296# Customize notice background colors on Sphinx < 1.6:
297if major == 1 and minor < 6:
298 latex_elements['preamble'] += '''
274 \\usepackage{ifthen} 299 \\usepackage{ifthen}
275 300
276 % Put notes in color and let them be inside a table 301 % Put notes in color and let them be inside a table
@@ -322,27 +347,26 @@ latex_elements = {
322 } 347 }
323 \\makeatother 348 \\makeatother
324 349
325 % Use some font with UTF-8 support with XeLaTeX
326 \\usepackage{fontspec}
327 \\setsansfont{DejaVu Serif}
328 \\setromanfont{DejaVu Sans}
329 \\setmonofont{DejaVu Sans Mono}
330
331 % To allow adjusting table sizes
332 \\usepackage{adjustbox}
333
334 ''' 350 '''
335}
336
337# Fix reference escape troubles with Sphinx 1.4.x
338if major == 1 and minor > 3:
339 latex_elements['preamble'] += '\\renewcommand*{\\DUrole}[2]{ #2 }\n'
340 351
341if major == 1 and minor <= 4: 352# With Sphinx 1.6, it is possible to change the Bg color directly
342 latex_elements['preamble'] += '\\usepackage[margin=0.5in, top=1in, bottom=1in]{geometry}' 353# by using:
343elif major == 1 and (minor > 5 or (minor == 5 and patch >= 3)): 354# \definecolor{sphinxnoteBgColor}{RGB}{204,255,255}
344 latex_elements['sphinxsetup'] = 'hmargin=0.5in, vmargin=1in' 355# \definecolor{sphinxwarningBgColor}{RGB}{255,204,204}
345 latex_elements['preamble'] += '\\fvset{fontsize=auto}\n' 356# \definecolor{sphinxattentionBgColor}{RGB}{255,255,204}
357# \definecolor{sphinximportantBgColor}{RGB}{192,255,204}
358#
359# However, it require to use sphinx heavy box with:
360#
361# \renewenvironment{sphinxlightbox} {%
362# \\begin{sphinxheavybox}
363# }
364# \\end{sphinxheavybox}
365# }
366#
367# Unfortunately, the implementation is buggy: if a note is inside a
368# table, it isn't displayed well. So, for now, let's use boring
369# black and white notes.
346 370
347# Grouping the document tree into LaTeX files. List of tuples 371# Grouping the document tree into LaTeX files. List of tuples
348# (source start file, target name, title, 372# (source start file, target name, title,