Closes #1987: Fix ampersand is ignored in `:menuselection: and :guilabel:` on LaTeX builder

This commit is contained in:
Takeshi KOMIYA 2015-09-01 00:28:33 +09:00
parent 5be5b057a9
commit 2c5c54aa67
3 changed files with 5 additions and 1 deletions

View File

@ -52,6 +52,7 @@ Bugs fixed
* #1540: Fix RuntimeError with circular referenced toctree * #1540: Fix RuntimeError with circular referenced toctree
* #1983: i18n translation feature breaks references which uses section name. * #1983: i18n translation feature breaks references which uses section name.
* #1990: Use caption of toctree to title of \tableofcontents in LaTeX * #1990: Use caption of toctree to title of \tableofcontents in LaTeX
* #1987: Fix ampersand is ignored in ``:menuselection:`` and ``:guilabel:`` on LaTeX builder
Release 1.3.1 (released Mar 17, 2015) Release 1.3.1 (released Mar 17, 2015)

View File

@ -1713,6 +1713,9 @@ class LaTeXTranslator(nodes.NodeVisitor):
if classes in [['menuselection'], ['guilabel']]: if classes in [['menuselection'], ['guilabel']]:
self.body.append(r'\emph{') self.body.append(r'\emph{')
self.context.append('}') self.context.append('}')
elif classes in [['accelerator']]:
self.body.append(r'\underline{')
self.context.append('}')
elif classes and not self.in_title: elif classes and not self.in_title:
self.body.append(r'\DUspan{%s}{' % ','.join(classes)) self.body.append(r'\DUspan{%s}{' % ','.join(classes))
self.context.append('}') self.context.append('}')

View File

@ -109,7 +109,7 @@ def test_inline():
yield (verify, ':guilabel:`&Foo -&&- &Bar`', yield (verify, ':guilabel:`&Foo -&&- &Bar`',
u'<p><span class="guilabel"><span class="accelerator">F</span>oo ' u'<p><span class="guilabel"><span class="accelerator">F</span>oo '
'-&amp;- <span class="accelerator">B</span>ar</span></p>', '-&amp;- <span class="accelerator">B</span>ar</span></p>',
r'\emph{\DUspan{accelerator}{F}oo -\&- \DUspan{accelerator}{B}ar}') r'\emph{\underline{F}oo -\&- \underline{B}ar}')
# non-interpolation of dashes in option role # non-interpolation of dashes in option role
yield (verify_re, ':option:`--with-option`', yield (verify_re, ':option:`--with-option`',