mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #2231: Use DUrole instead of DUspan for custom roles in LaTeX writer
This commit is contained in:
parent
3432377669
commit
6b36b31984
2
CHANGES
2
CHANGES
@ -8,6 +8,8 @@ Incompatible changes
|
||||
to accelerate stemming.
|
||||
* Now sphinx_rtd_theme become optional. Please install it manually.
|
||||
Refs #2087, #2086, #1845 and #2097. Thanks to Victor Zverovich.
|
||||
* #2231: Use DUrole instead of DUspan for custom roles in LaTeX writer. It enables to take
|
||||
title of roles as an argument of custom macros.
|
||||
|
||||
|
||||
Features added
|
||||
|
@ -444,15 +444,18 @@
|
||||
\RequirePackage{hypcap}
|
||||
|
||||
% From docutils.writers.latex2e
|
||||
\providecommand{\DUspan}[2]{%
|
||||
{% group ("span") to limit the scope of styling commands
|
||||
\@for\node@class@name:=#1\do{%
|
||||
\ifcsname docutilsrole\node@class@name\endcsname%
|
||||
\csname docutilsrole\node@class@name\endcsname%
|
||||
% inline markup (custom roles)
|
||||
% \DUrole{#1}{#2} tries \DUrole#1{#2}
|
||||
\providecommand*{\DUrole}[2]{%
|
||||
\ifcsname DUrole#1\endcsname%
|
||||
\csname DUrole#1\endcsname{#2}%
|
||||
\else% backwards compatibility: try \docutilsrole#1{#2}
|
||||
\ifcsname docutilsrole#1\endcsname%
|
||||
\csname docutilsrole#1\endcsname{#2}%
|
||||
\else%
|
||||
#2%
|
||||
\fi%
|
||||
}%
|
||||
{#2}% node content
|
||||
}% close "span"
|
||||
\fi%
|
||||
}
|
||||
|
||||
\providecommand*{\DUprovidelength}[2]{
|
||||
|
@ -1886,7 +1886,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
|
||||
self.body.append(r'\underline{')
|
||||
self.context.append('}')
|
||||
elif classes and not self.in_title:
|
||||
self.body.append(r'\DUspan{%s}{' % ','.join(classes))
|
||||
self.body.append(r'\DUrole{%s}{' % ','.join(classes))
|
||||
self.context.append('}')
|
||||
else:
|
||||
self.context.append('')
|
||||
|
Loading…
Reference in New Issue
Block a user