From eaccca52dd440d76ed73d5027a29c4192c98f444 Mon Sep 17 00:00:00 2001 From: Stuart Axon Date: Fri, 11 Oct 2019 00:29:00 +0100 Subject: [PATCH 1/2] Support inline SVGs (don't break on title in inline SVG). --- RELEASE.md | 3 +++ pelican/readers.py | 2 +- .../tests/content/article_with_inline_svg.html | 17 +++++++++++++++++ pelican/tests/test_generators.py | 2 ++ pelican/tests/test_readers.py | 7 +++++++ 5 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 RELEASE.md create mode 100644 pelican/tests/content/article_with_inline_svg.html diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 00000000..874bba5d --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,3 @@ +Release type: patch + +Support inline SVGs, don't treat titles in SVGs as HTML titles. Fixes #2561. diff --git a/pelican/readers.py b/pelican/readers.py index 0edfed0e..52378c4f 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -407,7 +407,7 @@ class HTMLReader(BaseReader): if self._in_head: self._in_head = False self._in_top_level = True - elif tag == 'title': + elif self._in_head and tag == 'title': self._in_title = False self.metadata['title'] = self._data_buffer elif tag == 'body': diff --git a/pelican/tests/content/article_with_inline_svg.html b/pelican/tests/content/article_with_inline_svg.html new file mode 100644 index 00000000..07f97a8a --- /dev/null +++ b/pelican/tests/content/article_with_inline_svg.html @@ -0,0 +1,17 @@ + + + Article with an inline SVG + + + Ensure that the title attribute in an inline svg is not handled as an HTML title. + + + A different title inside the inline SVG + + + + + + + + diff --git a/pelican/tests/test_generators.py b/pelican/tests/test_generators.py index 2455d1f4..9ade301e 100644 --- a/pelican/tests/test_generators.py +++ b/pelican/tests/test_generators.py @@ -262,6 +262,7 @@ class TestArticlesGenerator(unittest.TestCase): ['This is a super article !', 'published', 'yeah', 'article'], ['This is a super article !', 'published', 'yeah', 'article'], ['This is a super article !', 'published', 'Default', 'article'], + ['Article with an inline SVG', 'published', 'Default', 'article'], ['This is an article with category !', 'published', 'yeah', 'article'], ['This is an article with multiple authors!', 'published', @@ -554,6 +555,7 @@ class TestArticlesGenerator(unittest.TestCase): 'An Article With Code Block To Test Typogrify Ignore', 'Article title', 'Article with Nonconformant HTML meta tags', + 'Article with an inline SVG', 'Article with markdown and summary metadata multi', 'Article with markdown and summary metadata single', 'Article with markdown containing footnotes', diff --git a/pelican/tests/test_readers.py b/pelican/tests/test_readers.py index 30181f54..3f05bb4a 100644 --- a/pelican/tests/test_readers.py +++ b/pelican/tests/test_readers.py @@ -764,3 +764,10 @@ class HTMLReaderTest(ReaderTest): } self.assertDictHasSubset(page.metadata, expected) + + def test_article_with_inline_svg(self): + page = self.read_file(path='article_with_inline_svg.html') + expected = { + 'title': 'Article with an inline SVG', + } + self.assertDictHasSubset(page.metadata, expected) From 3be00060166ee23eb03d45508dd107554c0ce615 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Thu, 17 Oct 2019 10:42:59 -0700 Subject: [PATCH 2/2] Update RELEASE.md --- RELEASE.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 874bba5d..6b958464 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,3 +1,6 @@ -Release type: patch +Release type: minor -Support inline SVGs, don't treat titles in SVGs as HTML titles. Fixes #2561. +* Support inline SVGs; don't treat titles in SVGs as HTML titles +* Add category to feeds (in addition to tags) +* Improve content metadata field docs +* Add docs for including other Markdown/reST files in content