2015-11-03 7 views
5

Ich habe eine Tabelle in rst, und ich möchte eine Klasse hinzufügen, wenn Sie mit Sphinx zu HTML kompilieren. Nach the docs, Hinzufügen einer .. class:: Direktive vor der Tabelle sollte die Klasse der Tabelle hinzufügen, aber stattdessen fügt eine Definitionsliste hinzu.Hinzufügen einer Klasse zu einer Tabelle in Sphinx?

Der Tabellencode ist:

.. class:: special 

== == == 
a b c 
1 2 3 
== == == 

die Ergebnisse in:

<dl class="class"> 
<dt id="special"> 
<em class="property">class </em><code class="descname">special</code><a class="headerlink" href="#special" title="Permalink to this definition">¶</a></dt> 
<dd></dd></dl> 

<table border="1" class="docutils"> 
<colgroup> 
<col width="33%" /> 
<col width="33%" /> 
<col width="33%" /> 
</colgroup> 
<tbody valign="top"> 
<tr class="row-odd"><td>a</td> 
<td>b</td> 
<td>c</td> 
</tr> 
<tr class="row-even"><td>1</td> 
<td>2</td> 
<td>3</td> 
</tr> 
</tbody> 
</table> 

Was mache ich falsch? Ich benutze Sphinx 1.3.1

Antwort

8

Die Sphinx-Standarddomäne ist Python und es enthält eine class Direktive, die die ursprüngliche Docutils-Direktive mit dem gleichen Namen schattiert.

Um es funktioniert rst-class statt:

.. rst-class:: special 

== == == 
a b c 
1 2 3 
== == == 

http://sphinx-doc.org/rest.html#id3 See.

+0

Super, danke! – naught101

1

Alternativ können Sie stattdessen wickeln Sie Ihren Tisch mit einer .. table:: Richtlinie und verwenden seine :class: Option:

.. table:: 
    :class: special 

    == == == 
    a b c 
    1 2 3 
    == == == 

Siehe die entsprechenden docutils docs here.

Verwandte Themen