Using rsStructuredText to generate HTML, I am trying to wrap a <p>
paragraph with an extra div
element. The <div>
must contain an id
attribute with a value I assign. Also, the <p>
must have a class
attribute with "editable"
value.
This is what I have so far:
.. raw:: html
<div id="an_identifier">
.. class:: editable
paragraph content
.. raw:: html
</div>
This is the output:
<div id="an_identifier">
<p class="editable">paragraph content</p>
</div>
I already have got the results I was looking for, although I don't like having raw HTML embedded. My question is whether is there any directive or other method in reStructuredText to achieve the same results unobtrusively?
I've been just working on with something similar and I found the solution here. What you need to do is to use a custom directive and add it to an existing writer. You can simply add the directive (with small modifications) from the link to the rst2html.py script and you are all set. See also the documentation for creating directives.