Fix #2355: Define `\termref macro to redefine the style of term` roles.

This commit is contained in:
Takeshi KOMIYA 2016-03-02 22:50:38 +09:00
parent c05a0f9904
commit 8bdefa24d1
3 changed files with 5 additions and 1 deletions

View File

@ -17,6 +17,7 @@ Features added
* Define ``\menuselection`` and ``\accelerator`` macros to redefine the style of `menuselection` roles.
* Define ``\internalreference`` macro to redefine the style of references
* #2301: Texts in the classic html theme should be hyphenated.
* #2355: Define ``\termref`` macro to redefine the style of ``term`` roles.
Bugs fixed
----------

View File

@ -150,6 +150,7 @@
\newcommand{\menuselection}[1]{\emph{#1}}
\newcommand{\accelerator}[1]{\underline{#1}}
\newcommand{\internalreference}[1]{\emph{#1}}
\newcommand{\termref}[1]{\emph{#1}}
% Redefine the Verbatim environment to allow border and background colors.
% The original environment is still used for verbatims within tables.

View File

@ -1617,12 +1617,14 @@ class LaTeXTranslator(nodes.NodeVisitor):
# reference to a label
id = uri[1:].replace('#', ':')
self.body.append(self.hyperlink(id))
self.body.append(r'\internalreference{')
if len(node) and hasattr(node[0], 'attributes') and \
'std-term' in node[0].get('classes', []):
# don't add a pageref for glossary terms
self.context.append('}}}')
# mark up as termreference
self.body.append(r'\termref{')
else:
self.body.append(r'\internalreference{')
if self.builder.config.latex_show_pagerefs and not \
self.in_production_list:
self.context.append('}}} (%s)' % self.hyperpageref(id))