elifesciences / elife-crossref-xml-generation

Crossref deposit of journal articles
MIT License
4 stars 3 forks source link

Pass a pattern_type to generate_resource_url() #132

Closed gnott closed 2 years ago

gnott commented 2 years ago

Instead of setting default values for the pattern_type passed to generate_resource_url() when the argument is None, specify the value of pattern_type explicitly when the deposit will be for a journal_article or a component.

This can be considered a breaking change, if generate_resource_url() was used directly, however using doi. set_article_doi_data() or component.set_component_doi() these are changed to be backwards compatible by passing in the appropriate value for the pattern_type.

For background, the pattern_type value is used to find a string pattern replacement value from the crossref.cfg config file, which is used to generate a uri for a doi, which ends up in the <doi_data> tag of a Crossref deposit.

A new version of this library 0.14.0 is set for this change.

It is in preparation for adding support for depositing posted_content, where these default pattern_type value were making it inflexible to populate the uri from an Article object's self_uri property.

(I hope this lengthy description makes sense, it's hard to explain!)