Split multiple authors on ','

This commit is contained in:
Ben Bridts 2014-02-18 17:56:57 +01:00
commit 05d357e98e
3 changed files with 8 additions and 2 deletions

View file

@ -46,7 +46,7 @@ METADATA_PROCESSORS = {
'status': lambda x, y: x.strip(), 'status': lambda x, y: x.strip(),
'category': Category, 'category': Category,
'author': Author, 'author': Author,
'authors': lambda x, y: [Author(author, y) for author in x], 'authors': lambda x, y: [Author(author.strip(), y) for author in x.split(',')],
} }
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

View file

@ -0,0 +1,6 @@
<html>
<head>
<title>This is an article with multiple authors!</title>
<meta name="authors" content="First Author, Second Author" />
</head>
</html>

View file

@ -361,7 +361,7 @@ class HTMLReaderTest(ReaderTest):
self.assertEqual(value, page.metadata[key], key) self.assertEqual(value, page.metadata[key], key)
def test_article_with_multiple_authors(self): def test_article_with_multiple_authors(self):
page = self.read_file(path='article_with_multiple_authors.rst') page = self.read_file(path='article_with_multiple_authors.html')
expected = { expected = {
'authors': ['First Author', 'Second Author'] 'authors': ['First Author', 'Second Author']
} }