Store custom namespace elements inside author/contributor in their dict #540
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related to #24 and #145, but only affects elements inside
<author>or<contributor>. This specifically solves the incorrect parsing of arXiv Atom feeds mentioned in #145, where author affiliations were lost.Problem
Custom namespace elements (e.g.
<arxiv:affiliation>) inside<author>or<contributor>are stored at entry level, causing:Scope
This PR does not solve the general problem of how to handle unknown elements (whether to store on the parent, aggregate into a list, or assign as dict fields). However:
Example
Before:
After:
Alternatives considered
Adding explicit support for the
arXivnamespace (likeitunes,dc,media). However, this would increase maintenance burden, and wouldn't help other custom namespaces.Implementation
The fix is small (~10 lines):
_maybe_get_author_context()to return current author/contributor dict if inside onepop()to store unknown elements in author context when applicable_end_author()/_end_contributor()exit author/contributor context beforepop()Tests
tests/wellformed/atom10/to cover custom elements inside<author>and<contributor>.