chiark / gitweb /
htmlsanity: don't put comments into HTML as <!-- -->.
authorVladimír Vondruš <mosra@centrum.cz>
Mon, 23 Oct 2017 07:28:25 +0000 (09:28 +0200)
committerVladimír Vondruš <mosra@centrum.cz>
Mon, 23 Oct 2017 07:28:25 +0000 (09:28 +0200)
The escaping is weird for the license header because of <> and I don't
think this is of any use.

doc/pelican/writing-content.rst
doc/plugins/htmlsanity.rst
pelican-plugins/m/htmlsanity.py

index d16692006805fa6743fd52de0423747e9a503e18..a13f669727a4a550df0c6c57f56f1997f9fb2b64 100644 (file)
@@ -95,8 +95,8 @@ Example:
 
     Another character used, another level of headings.
 
-    .. a comment which is rendered to HTML output enclosed in <!-- -->
-        characters. This is still a comment.
+    .. a comment, which is simply ignored when producing HTML output.
+        This is still a comment.
 
         This as well.
             and
index 051ed80aff650728c9ccc46c42466554a3256d59..8ac4ed1a34bb1686996986a27b37c08684431868 100644 (file)
@@ -82,6 +82,8 @@ horrible, right?) with a custom HTML5 writer derived from
 -   Line blocks are simply :html:`<p>` elements with lines delimited using
     :html:`<br>`
 -   The :html:`<abbr>` tag now properly includes a ``title`` attribute
+-   :abbr:`reST <reStructuredText>` comments are simply ignored, instead of
+    being put into :html:`<!-- -->`
 
 `Typography`_
 =============
index 1a2c7150f109a05f1a4e5406a61660ce0d7cf984..4e55a02a168e9873fd3faca1e8db3518bb1d4d51 100644 (file)
@@ -340,6 +340,11 @@ class SaneHtmlTranslator(HTMLTranslator):
             ('colwidths-given' not in node.parent.parent['classes'])):
             return
 
+    # Don't put comments into the HTML output
+    def visit_comment(self, node,
+                      sub=re.compile('-(?=-)').sub):
+        raise nodes.SkipNode
+
     # Containers don't need those stupid "docutils" class names
     def visit_container(self, node):
         atts = {}