From beba0d7118b294258933bf2ace5a36600bbf76fc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 23 Oct 2017 09:28:25 +0200 Subject: [PATCH] htmlsanity: don't put comments into HTML as . 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 | 4 ++-- doc/plugins/htmlsanity.rst | 2 ++ pelican-plugins/m/htmlsanity.py | 5 +++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/doc/pelican/writing-content.rst b/doc/pelican/writing-content.rst index d1669200..a13f6697 100644 --- a/doc/pelican/writing-content.rst +++ b/doc/pelican/writing-content.rst @@ -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 diff --git a/doc/plugins/htmlsanity.rst b/doc/plugins/htmlsanity.rst index 051ed80a..8ac4ed1a 100644 --- a/doc/plugins/htmlsanity.rst +++ b/doc/plugins/htmlsanity.rst @@ -82,6 +82,8 @@ horrible, right?) with a custom HTML5 writer derived from - Line blocks are simply :html:`

` elements with lines delimited using :html:`
` - The :html:`` tag now properly includes a ``title`` attribute +- :abbr:`reST ` comments are simply ignored, instead of + being put into :html:`` `Typography`_ ============= diff --git a/pelican-plugins/m/htmlsanity.py b/pelican-plugins/m/htmlsanity.py index 1a2c7150..4e55a02a 100644 --- a/pelican-plugins/m/htmlsanity.py +++ b/pelican-plugins/m/htmlsanity.py @@ -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 = {} -- 2.30.2