diff options
author | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-09-03 16:12:46 -0300 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2017-09-08 10:02:44 -0600 |
commit | 9fdcd6afd8990889aeebcfa93ef79b402cdeb8a3 (patch) | |
tree | b7d6998c063989f169017568905ccd3b7e0e74f0 /Documentation | |
parent | c4b326e1a6b40ee403d37acd1363ade36e9b6fbe (diff) | |
download | linux-9fdcd6afd8990889aeebcfa93ef79b402cdeb8a3.tar.gz linux-9fdcd6afd8990889aeebcfa93ef79b402cdeb8a3.tar.bz2 linux-9fdcd6afd8990889aeebcfa93ef79b402cdeb8a3.zip |
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')
-rw-r--r-- | Documentation/conf.py | 62 |
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 = { # Additional stuff for the LaTeX preamble. 'preamble': ''' + % Use some font with UTF-8 support with XeLaTeX + \\usepackage{fontspec} + \\setsansfont{DejaVu Serif} + \\setromanfont{DejaVu Sans} + \\setmonofont{DejaVu Sans Mono} + + % To allow adjusting table sizes + \\usepackage{adjustbox} + + ''' +} + +# Fix reference escape troubles with Sphinx 1.4.x +if major == 1 and minor > 3: + latex_elements['preamble'] += '\\renewcommand*{\\DUrole}[2]{ #2 }\n' + +if major == 1 and minor <= 4: + latex_elements['preamble'] += '\\usepackage[margin=0.5in, top=1in, bottom=1in]{geometry}' +elif major == 1 and (minor > 5 or (minor == 5 and patch >= 3)): + latex_elements['sphinxsetup'] = 'hmargin=0.5in, vmargin=1in' + latex_elements['preamble'] += '\\fvset{fontsize=auto}\n' + +# Customize notice background colors on Sphinx < 1.6: +if major == 1 and minor < 6: + latex_elements['preamble'] += ''' \\usepackage{ifthen} % Put notes in color and let them be inside a table @@ -322,27 +347,26 @@ latex_elements = { } \\makeatother - % Use some font with UTF-8 support with XeLaTeX - \\usepackage{fontspec} - \\setsansfont{DejaVu Serif} - \\setromanfont{DejaVu Sans} - \\setmonofont{DejaVu Sans Mono} - - % To allow adjusting table sizes - \\usepackage{adjustbox} - ''' -} - -# Fix reference escape troubles with Sphinx 1.4.x -if major == 1 and minor > 3: - latex_elements['preamble'] += '\\renewcommand*{\\DUrole}[2]{ #2 }\n' -if major == 1 and minor <= 4: - latex_elements['preamble'] += '\\usepackage[margin=0.5in, top=1in, bottom=1in]{geometry}' -elif major == 1 and (minor > 5 or (minor == 5 and patch >= 3)): - latex_elements['sphinxsetup'] = 'hmargin=0.5in, vmargin=1in' - latex_elements['preamble'] += '\\fvset{fontsize=auto}\n' +# With Sphinx 1.6, it is possible to change the Bg color directly +# by using: +# \definecolor{sphinxnoteBgColor}{RGB}{204,255,255} +# \definecolor{sphinxwarningBgColor}{RGB}{255,204,204} +# \definecolor{sphinxattentionBgColor}{RGB}{255,255,204} +# \definecolor{sphinximportantBgColor}{RGB}{192,255,204} +# +# However, it require to use sphinx heavy box with: +# +# \renewenvironment{sphinxlightbox} {% +# \\begin{sphinxheavybox} +# } +# \\end{sphinxheavybox} +# } +# +# Unfortunately, the implementation is buggy: if a note is inside a +# table, it isn't displayed well. So, for now, let's use boring +# black and white notes. # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, |