forked from github/pelican
Merge pull request #1837 from SimonStJG/fix-quote-escaping-in-html-attributes
Fix quote escaping in HTML attributes. Fixes issue #1260.
This commit is contained in:
commit
1bbffad7b9
5 changed files with 47 additions and 11 deletions
|
|
@ -0,0 +1,11 @@
|
|||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
Ensure that if an attribute value contains a double quote, it is
|
||||
surrounded with single quotes, otherwise with double quotes.
|
||||
<span data-test="'single quoted string'">Span content</span>
|
||||
<span data-test='"double quoted string"'>Span content</span>
|
||||
<span data-test="string without quotes">Span content</span>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -61,7 +61,7 @@ class TestCache(unittest.TestCase):
|
|||
- article_with_null_attributes.html
|
||||
- 2012-11-30_md_w_filename_meta#foo-bar.md
|
||||
"""
|
||||
self.assertEqual(generator.readers.read_file.call_count, 3)
|
||||
self.assertEqual(generator.readers.read_file.call_count, 4)
|
||||
|
||||
@unittest.skipUnless(MagicMock, 'Needs Mock module')
|
||||
def test_article_reader_content_caching(self):
|
||||
|
|
|
|||
|
|
@ -587,6 +587,17 @@ class HTMLReaderTest(ReaderTest):
|
|||
<input name="test" disabled style="" />
|
||||
''', page.content)
|
||||
|
||||
def test_article_with_attributes_containing_double_quotes(self):
|
||||
page = self.read_file(path='article_with_attributes_containing_' +
|
||||
'double_quotes.html')
|
||||
self.assertEqual('''
|
||||
Ensure that if an attribute value contains a double quote, it is
|
||||
surrounded with single quotes, otherwise with double quotes.
|
||||
<span data-test="'single quoted string'">Span content</span>
|
||||
<span data-test='"double quoted string"'>Span content</span>
|
||||
<span data-test="string without quotes">Span content</span>
|
||||
''', page.content)
|
||||
|
||||
def test_article_metadata_key_lowercase(self):
|
||||
# Keys of metadata should be lowercase.
|
||||
page = self.read_file(path='article_with_uppercase_metadata.html')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue