From: Vladimír Vondruš Date: Mon, 23 Oct 2017 07:28:25 +0000 (+0200) Subject: htmlsanity: don't put comments into HTML as . X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=beba0d7118b294258933bf2ace5a36600bbf76fc;p=blog.git 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. --- 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 = {}