mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Get HtmlReader to work again
wrote unit tests and documentation, improved regular expression. The HtmlReader is enabled by default now and parses metadata in html files of the form: <!-- key:value -->
This commit is contained in:
parent
88555de28c
commit
39db9ddcfd
7 changed files with 72 additions and 15 deletions
|
|
@ -90,3 +90,24 @@ class MdReaderTest(unittest.TestCase):
|
|||
"<p>This is another markdown test file. Uses the mkd extension.</p>"
|
||||
|
||||
self.assertEqual(content, expected)
|
||||
|
||||
|
||||
class HtmlReaderTest(unittest.TestCase):
|
||||
|
||||
def test_article_with_metadata(self):
|
||||
reader = readers.HtmlReader({})
|
||||
content, metadata = reader.read(_filename('article_with_html_metadata.html'))
|
||||
expected = {
|
||||
'category': 'yeah',
|
||||
'author': u'Alexis Métaireau',
|
||||
'title': 'A great html article with metadata',
|
||||
'summary': u'Multi-line metadata should be'\
|
||||
u' supported\nas well as <strong>inline'\
|
||||
u' markup</strong>.',
|
||||
'date': datetime.datetime(2010, 12, 2, 10, 14),
|
||||
'tags': ['foo', 'bar', 'foobar'],
|
||||
'custom_field': 'http://notmyidea.org',
|
||||
}
|
||||
|
||||
for key, value in expected.items():
|
||||
self.assertEquals(value, metadata[key], key)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue