diff options
| author | grubert <grubert@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2006-04-04 15:58:44 +0000 |
|---|---|---|
| committer | grubert <grubert@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2006-04-04 15:58:44 +0000 |
| commit | 0f25fdf89fcbf00d35f3eac8b5f602bfcafb259c (patch) | |
| tree | 1ca40fd929fdc94b2d1e93c6f3be7d6bd93f489d | |
| parent | a3ac5a9c2a553b6782ce4956489f386585350a4d (diff) | |
| download | docutils-0f25fdf89fcbf00d35f3eac8b5f602bfcafb259c.tar.gz | |
Add custom role with two classes.
Change latex2e visit/depart_inline to handle it.
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@4500 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
4 files changed, 20 insertions, 8 deletions
diff --git a/docutils/docutils/writers/latex2e/__init__.py b/docutils/docutils/writers/latex2e/__init__.py index d3d7706bd..ec8d6dc83 100644 --- a/docutils/docutils/writers/latex2e/__init__.py +++ b/docutils/docutils/writers/latex2e/__init__.py @@ -2002,16 +2002,13 @@ class LaTeXTranslator(nodes.NodeVisitor): raise nodes.SkipNode def visit_inline(self, node): # titlereference - if node.get('class'): - cls = node['class'] - elif node.get('classes'): - cls = node['classes'][0] - else: - cls = 'Unknown' - self.body.append( '\\docutilsrole%s{' % cls) + classes = node.get('classes', ['Unknown', ]) + for cls in classes: + self.body.append( '\\docutilsrole%s{' % cls) + self.context.append('}'*len(classes)) def depart_inline(self, node): - self.body.append( '}' ) + self.body.append(self.context.pop()) def depart_topic(self, node): self.topic_classes = [] diff --git a/docutils/test/functional/expected/standalone_rst_html4css1.html b/docutils/test/functional/expected/standalone_rst_html4css1.html index 911beaa56..406c265a7 100644 --- a/docutils/test/functional/expected/standalone_rst_html4css1.html +++ b/docutils/test/functional/expected/standalone_rst_html4css1.html @@ -975,6 +975,9 @@ crunchy, now would it?</td> <li><p class="first">A role with class attribute.</p> <p><span class="special">interpreted text</span></p> </li> +<li><p class="first">A role with class attribute.</p> +<p><span class="very special">interpreted text</span></p> +</li> </ul> </div> </div> diff --git a/docutils/test/functional/expected/standalone_rst_latex.tex b/docutils/test/functional/expected/standalone_rst_latex.tex index f37b8dd63..6b873be04 100644 --- a/docutils/test/functional/expected/standalone_rst_latex.tex +++ b/docutils/test/functional/expected/standalone_rst_latex.tex @@ -1544,6 +1544,11 @@ A role with class attribute. \docutilsrolespecial{interpreted text} +\item {} +A role with class attribute. + +\docutilsrolevery{\docutilsrolespecial{interpreted text}} + \end{itemize} diff --git a/docutils/test/functional/input/data/custom_roles.txt b/docutils/test/functional/input/data/custom_roles.txt index c80b3587f..872005cbd 100644 --- a/docutils/test/functional/input/data/custom_roles.txt +++ b/docutils/test/functional/input/data/custom_roles.txt @@ -20,3 +20,10 @@ Custom Roles :customclass:`interpreted text` +* A role with class attribute. + + .. role:: customx + :class: very special + + :customx:`interpreted text` + |
