From 05d357e98e9c948eaddfcfe3db9895b7ab5e9bf0 Mon Sep 17 00:00:00 2001 From: Ben Bridts Date: Tue, 18 Feb 2014 17:56:57 +0100 Subject: [PATCH] Split multiple authors on ',' --- pelican/readers.py | 2 +- pelican/tests/content/article_with_multiple_authors.html | 6 ++++++ pelican/tests/test_readers.py | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 pelican/tests/content/article_with_multiple_authors.html diff --git a/pelican/readers.py b/pelican/readers.py index 1e00aefa..fb800b2b 100644 --- a/pelican/readers.py +++ b/pelican/readers.py @@ -46,7 +46,7 @@ METADATA_PROCESSORS = { 'status': lambda x, y: x.strip(), 'category': Category, '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__) diff --git a/pelican/tests/content/article_with_multiple_authors.html b/pelican/tests/content/article_with_multiple_authors.html new file mode 100644 index 00000000..a74442c9 --- /dev/null +++ b/pelican/tests/content/article_with_multiple_authors.html @@ -0,0 +1,6 @@ + + + This is an article with multiple authors! + + + diff --git a/pelican/tests/test_readers.py b/pelican/tests/test_readers.py index acb268fb..6274bdc5 100644 --- a/pelican/tests/test_readers.py +++ b/pelican/tests/test_readers.py @@ -361,7 +361,7 @@ class HTMLReaderTest(ReaderTest): self.assertEqual(value, page.metadata[key], key) 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 = { 'authors': ['First Author', 'Second Author'] }