Discussion:
[Docutils-users] Output rst comments to HTML5?
Matěj Cepl
2017-02-27 21:42:47 UTC
Permalink
Would it be possible to persuade rst2html5 to output comments as
<p class="comment"> (or something of that sort) in HTML? So,
that it would be possible to have comments visible in the draft
version of the document?

Matěj
--
https://matej.ceplovi.cz/blog/, Jabber: ***@ceplovi.cz
GPG Finger: 3C76 A027 CA45 AD70 98B5 BC1D 7920 5802 880B C9D8

My opinions may have changed, but not the fact that I am right.
--Ashleigh Brilliant


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Docutils-users mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply All" to reply to
Guenter Milde
2017-02-28 07:51:34 UTC
Permalink
Dear Matěj,
Post by Matěj Cepl
Would it be possible to persuade rst2html5 to output comments as
<p class="comment"> (or something of that sort) in HTML? So,
that it would be possible to have comments visible in the draft
version of the document?
This is possible via subclassing the writer and overriding the
visist_comment/depart_comment
methods.

The simpler method would be to set the class in the rst source::

.. class:: comment

This is a paragraph with class="comment" in all export formats.

which becomes::

<document source="/tmp/comm.rst">
<paragraph classes="comment">
This is a paragraph with class="comment" in all export formats.

(The class directive allows content, an empty class directive is applied to
the next element.)

Changing these comments to "real" rst comments is a simple replace-all task.

Günter

Continue reading on narkive:
Loading...