diff --git a/CHANGES.rst b/CHANGES.rst index 8fb228a5..b85b3eef 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -14,9 +14,14 @@ Unreleased * Add ``--json`` option to the ``list`` CLI commands. Thanks to `Puneet Dixit`_ for the PR. (:issue:`394`) - +* Add :attr:`~Entry.authors` (and corresponding attributes on feeds and sources) + to expose multiple authors and rich author data (name, email, URL). + The old ``author`` string attribute is deprecated. + Thanks to `Anshul Mittal`_ for the PR. + (:issue:`391`) .. _Puneet Dixit: https://github.com/puneetdixit200 +.. _Anshul Mittal: https://github.com/anderson688 Version 3.23 diff --git a/docs/api.rst b/docs/api.rst index 2e8b295a..7f5e14ba 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -28,6 +28,9 @@ Data objects .. autoclass:: Feed :members: +.. autoclass:: Author + :members: + .. autoclass:: ExceptionInfo :members: diff --git a/docs/conf.py b/docs/conf.py index 6731bfcb..91a5dafd 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -19,6 +19,8 @@ 'werkzeug.exceptions', 'werkzeug.http', 'yaml', + 'structlog', + 'structlog.contextvars', ]: sys.modules[name] = unittest.mock.Mock() diff --git a/docs/guide.rst b/docs/guide.rst index 097a78bb..c1163302 100644 --- a/docs/guide.rst +++ b/docs/guide.rst @@ -374,7 +374,7 @@ As seen in the previous sections, updated=datetime.datetime(2020, 2, 28, 9, 34, 2, tzinfo=datetime.timezone.utc), title='Hello Internet', link='http://www.hellointernet.fm/', - author='CGP Grey', + authors=(Author(name='CGP Grey'),), subtitle='CGP Grey and Brady Haran talk about YouTube, life, work, whatever.', version='rss20', user_title=None, @@ -386,9 +386,10 @@ As seen in the previous sections, To get all the feeds, use the :meth:`~Reader.get_feeds` method:: >>> for feed in reader.get_feeds(): + ... authors = ", ".join(a.name for a in feed.authors if a.name) or 'unknown author' ... print( ... feed.title or feed.url, - ... f"by {feed.author or 'unknown author'},", + ... f"by {authors},", ... f"updated on {feed.updated or 'never'}", ... ) ... diff --git a/src/reader/__init__.py b/src/reader/__init__.py index 51e718ec..1fe2dafc 100644 --- a/src/reader/__init__.py +++ b/src/reader/__init__.py @@ -67,6 +67,7 @@ FeedToImport as FeedToImport, FeedImportResult as FeedImportResult, FeedExport as FeedExport, + Author as Author, ) from .exceptions import ( diff --git a/src/reader/_app/legacy/templates/entry.html b/src/reader/_app/legacy/templates/entry.html index 46df1694..b1e1ccb1 100644 --- a/src/reader/_app/legacy/templates/entry.html +++ b/src/reader/_app/legacy/templates/entry.html @@ -18,7 +18,15 @@