mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #2355: Define `\termref
macro to redefine the style of
term
` roles.
This commit is contained in:
parent
c05a0f9904
commit
8bdefa24d1
1
CHANGES
1
CHANGES
@ -17,6 +17,7 @@ Features added
|
|||||||
* Define ``\menuselection`` and ``\accelerator`` macros to redefine the style of `menuselection` roles.
|
* Define ``\menuselection`` and ``\accelerator`` macros to redefine the style of `menuselection` roles.
|
||||||
* Define ``\internalreference`` macro to redefine the style of references
|
* Define ``\internalreference`` macro to redefine the style of references
|
||||||
* #2301: Texts in the classic html theme should be hyphenated.
|
* #2301: Texts in the classic html theme should be hyphenated.
|
||||||
|
* #2355: Define ``\termref`` macro to redefine the style of ``term`` roles.
|
||||||
|
|
||||||
Bugs fixed
|
Bugs fixed
|
||||||
----------
|
----------
|
||||||
|
@ -150,6 +150,7 @@
|
|||||||
\newcommand{\menuselection}[1]{\emph{#1}}
|
\newcommand{\menuselection}[1]{\emph{#1}}
|
||||||
\newcommand{\accelerator}[1]{\underline{#1}}
|
\newcommand{\accelerator}[1]{\underline{#1}}
|
||||||
\newcommand{\internalreference}[1]{\emph{#1}}
|
\newcommand{\internalreference}[1]{\emph{#1}}
|
||||||
|
\newcommand{\termref}[1]{\emph{#1}}
|
||||||
|
|
||||||
% Redefine the Verbatim environment to allow border and background colors.
|
% Redefine the Verbatim environment to allow border and background colors.
|
||||||
% The original environment is still used for verbatims within tables.
|
% The original environment is still used for verbatims within tables.
|
||||||
|
@ -1617,12 +1617,14 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
|||||||
# reference to a label
|
# reference to a label
|
||||||
id = uri[1:].replace('#', ':')
|
id = uri[1:].replace('#', ':')
|
||||||
self.body.append(self.hyperlink(id))
|
self.body.append(self.hyperlink(id))
|
||||||
self.body.append(r'\internalreference{')
|
|
||||||
if len(node) and hasattr(node[0], 'attributes') and \
|
if len(node) and hasattr(node[0], 'attributes') and \
|
||||||
'std-term' in node[0].get('classes', []):
|
'std-term' in node[0].get('classes', []):
|
||||||
# don't add a pageref for glossary terms
|
# don't add a pageref for glossary terms
|
||||||
self.context.append('}}}')
|
self.context.append('}}}')
|
||||||
|
# mark up as termreference
|
||||||
|
self.body.append(r'\termref{')
|
||||||
else:
|
else:
|
||||||
|
self.body.append(r'\internalreference{')
|
||||||
if self.builder.config.latex_show_pagerefs and not \
|
if self.builder.config.latex_show_pagerefs and not \
|
||||||
self.in_production_list:
|
self.in_production_list:
|
||||||
self.context.append('}}} (%s)' % self.hyperpageref(id))
|
self.context.append('}}} (%s)' % self.hyperpageref(id))
|
||||||
|
Loading…
Reference in New Issue
Block a user