Imported Upstream version 3.2.1 upstream/3.2.1
authorHyunjee Kim <hj0426.kim@samsung.com>
Thu, 14 May 2020 04:32:38 +0000 (13:32 +0900)
committerHyunjee Kim <hj0426.kim@samsung.com>
Thu, 14 May 2020 04:32:43 +0000 (13:32 +0900)
Change-Id: I9c8753dc556f770e78c5aab466cc99d68009d31e
Signed-off-by: Hyunjee Kim <hj0426.kim@samsung.com>
Markdown.egg-info/PKG-INFO
PKG-INFO
docs/change_log/index.md
markdown/__meta__.py
markdown/extensions/toc.py
tests/test_extensions.py

index 3455bb31ce1d0220c717f6ed656184f3b96d3934..9526d2b64665a8eab73e49f771e825014c63448e 100644 (file)
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: Markdown
-Version: 3.2
+Version: 3.2.1
 Summary: Python implementation of Markdown.
 Home-page: https://Python-Markdown.github.io/
 Author: Manfred Stienstra, Yuri takhteyev and Waylan limberg
@@ -8,7 +8,7 @@ Author-email: waylan.limberg@icloud.com
 Maintainer: Waylan Limberg
 Maintainer-email: waylan.limberg@icloud.com
 License: BSD License
-Download-URL: http://pypi.python.org/packages/source/M/Markdown/Markdown-3.2-py2.py3-none-any.whl
+Download-URL: http://pypi.python.org/packages/source/M/Markdown/Markdown-3.2.1-py2.py3-none-any.whl
 Description: 
         This is a Python implementation of John Gruber's Markdown_.
         It is almost completely compliant with the reference implementation,
index 3455bb31ce1d0220c717f6ed656184f3b96d3934..9526d2b64665a8eab73e49f771e825014c63448e 100644 (file)
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: Markdown
-Version: 3.2
+Version: 3.2.1
 Summary: Python implementation of Markdown.
 Home-page: https://Python-Markdown.github.io/
 Author: Manfred Stienstra, Yuri takhteyev and Waylan limberg
@@ -8,7 +8,7 @@ Author-email: waylan.limberg@icloud.com
 Maintainer: Waylan Limberg
 Maintainer-email: waylan.limberg@icloud.com
 License: BSD License
-Download-URL: http://pypi.python.org/packages/source/M/Markdown/Markdown-3.2-py2.py3-none-any.whl
+Download-URL: http://pypi.python.org/packages/source/M/Markdown/Markdown-3.2.1-py2.py3-none-any.whl
 Description: 
         This is a Python implementation of John Gruber's Markdown_.
         It is almost completely compliant with the reference implementation,
index 9d17a42cbb0b422c7f3c6043d375b7b5fa6e3175..62fe4b24be6f1a4c5c76018061e2f399ab62b123 100644 (file)
@@ -3,6 +3,11 @@ title: Change Log
 Python-Markdown Change Log
 =========================
 
+Feb 12, 2020: Released version 3.2.1 (a bug-fix release). 
+
+* The `name` property in `toc_tokens` from the TOC extension now
+  escapes HTML special characters (`<`, `>`, and `&`).
+
 Feb 7, 2020: Released version 3.2 ([Notes](release-3.2.md)).
 
 May 20, 2019: Released version 3.1.1 (a bug-fix release).
index ec83f158a62fac18c6ad86e2202ca71c11a76920..ead7c3165600c8d6a47b7709f17a294d5bcecca3 100644 (file)
@@ -31,7 +31,7 @@ except ImportError:
 # (1, 2, 0, 'beta', 2) => "1.2b2"
 # (1, 2, 0, 'rc', 4) => "1.2rc4"
 # (1, 2, 0, 'final', 0) => "1.2"
-__version_info__ = (3, 2, 0, 'final', 0)
+__version_info__ = (3, 2, 1, 'final', 0)
 
 
 def _get_version():  # pragma: no cover
index dc80c7e8ecd3ee4e9f5d7702a9b13082a83e0314..8f2b13f39d7339e5a653389507b12079e46b8a2b 100644 (file)
@@ -15,7 +15,7 @@ License: [BSD](https://opensource.org/licenses/bsd-license.php)
 
 from . import Extension
 from ..treeprocessors import Treeprocessor
-from ..util import parseBoolValue, AMP_SUBSTITUTE, HTML_PLACEHOLDER_RE
+from ..util import code_escape, parseBoolValue, AMP_SUBSTITUTE, HTML_PLACEHOLDER_RE
 from ..postprocessors import UnescapePostprocessor
 import re
 import unicodedata
@@ -264,7 +264,8 @@ class TocTreeprocessor(Treeprocessor):
                     'level': int(el.tag[-1]),
                     'id': el.attrib["id"],
                     'name': unescape(stashedHTML2text(
-                        el.attrib.get('data-toc-label', text), self.md, strip_entities=False
+                        code_escape(el.attrib.get('data-toc-label', text)),
+                        self.md, strip_entities=False
                     ))
                 })
 
index c787886c8732beec6cc37c9da73979cbb5a0d569..8ecbe0d766e61a2402afab7bdd2eb6dc674a74e0 100644 (file)
@@ -827,6 +827,25 @@ class TestTOC(TestCaseWithAssertStartsWith):
             {'level': 1, 'id': 'foo-bar', 'name': 'Foo &amp; bar', 'children': []},
         ])
 
+    def testHtmlSpecialChars(self):
+        """ Test Headers with HTML special characters. """
+        text = '# Foo > & bar'
+        self.assertEqual(
+            self.md.convert(text),
+            '<h1 id="foo-bar">Foo &gt; &amp; bar</h1>'
+        )
+        self.assertEqual(
+            self.md.toc,
+            '<div class="toc">\n'
+              '<ul>\n'                                                  # noqa
+                '<li><a href="#foo-bar">Foo &gt; &amp; bar</a></li>\n'  # noqa
+              '</ul>\n'                                                 # noqa
+            '</div>\n'
+        )
+        self.assertEqual(self.md.toc_tokens, [
+            {'level': 1, 'id': 'foo-bar', 'name': 'Foo &gt; &amp; bar', 'children': []},
+        ])
+
     def testRawHtml(self):
         """ Test Headers with raw HTML. """
         text = '# Foo <b>Bar</b> Baz.'
@@ -1000,27 +1019,31 @@ class TestTOC(TestCaseWithAssertStartsWith):
         md = markdown.Markdown(extensions=['toc', 'attr_list'])
         text = ('# Header 1\n\n'
                 '## Header 2 { #foo }\n\n'
-                '## Header 3 { data-toc-label="Foo Bar"}\n\n'
-                '# Header 4 { data-toc-label="Foo <b>Baz</b>" }')
+                '## Header 3 { data-toc-label="Foo Bar" }\n\n'
+                '# Header 4 { data-toc-label="Foo > Baz" }\n\n'
+                '# Header 5 { data-toc-label="Foo <b>Quux</b>" }')
+
         self.assertEqual(
             md.convert(text),
             '<h1 id="header-1">Header 1</h1>\n'
             '<h2 id="foo">Header 2</h2>\n'
             '<h2 id="header-3">Header 3</h2>\n'
-            '<h1 id="header-4">Header 4</h1>'
+            '<h1 id="header-4">Header 4</h1>\n'
+            '<h1 id="header-5">Header 5</h1>'
         )
         self.assertEqual(
             md.toc,
             '<div class="toc">\n'
-              '<ul>\n'                                            # noqa
-                '<li><a href="#header-1">Header 1</a>'            # noqa
-                  '<ul>\n'                                        # noqa
-                    '<li><a href="#foo">Header 2</a></li>\n'      # noqa
-                    '<li><a href="#header-3">Foo Bar</a></li>\n'  # noqa
-                  '</ul>\n'                                       # noqa
-                '</li>\n'                                         # noqa
-                '<li><a href="#header-4">Foo Baz</a></li>\n'      # noqa
-              '</ul>\n'                                           # noqa
+              '<ul>\n'                                             # noqa
+                '<li><a href="#header-1">Header 1</a>'             # noqa
+                  '<ul>\n'                                         # noqa
+                    '<li><a href="#foo">Header 2</a></li>\n'       # noqa
+                    '<li><a href="#header-3">Foo Bar</a></li>\n'   # noqa
+                  '</ul>\n'                                        # noqa
+                '</li>\n'                                          # noqa
+                '<li><a href="#header-4">Foo &gt; Baz</a></li>\n'  # noqa
+                '<li><a href="#header-5">Foo Quux</a></li>\n'      # noqa
+              '</ul>\n'                                            # noqa
             '</div>\n'
         )
         self.assertEqual(md.toc_tokens, [
@@ -1028,7 +1051,8 @@ class TestTOC(TestCaseWithAssertStartsWith):
                 {'level': 2, 'id': 'foo', 'name': 'Header 2', 'children': []},
                 {'level': 2, 'id': 'header-3', 'name': 'Foo Bar', 'children': []}
             ]},
-            {'level': 1, 'id': 'header-4', 'name': 'Foo Baz', 'children': []},
+            {'level': 1, 'id': 'header-4', 'name': 'Foo &gt; Baz', 'children': []},
+            {'level': 1, 'id': 'header-5', 'name': 'Foo Quux', 'children': []},
         ])
 
     def testUniqueFunc(self):