Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed an issue with middle names and added support for page ranges in RIS and BIB exports (zotero, endnote, etc) #4385

Merged
merged 2 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/submission/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1399,6 +1399,11 @@ def author_list(self):
else:
return ", ".join([author.full_name() for author in self.authors.all()])

def bibtex_author_list(self):
return " and ".join(
[author.full_name() for author in self.frozen_authors()],
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the spec recommends "AND" (all uppercase) as the separator : https://bibtex.eu/fields/author/


def keyword_list_str(self, separator=","):
if self.keywords.exists():
return separator.join(kw.word for kw in self.keywords.all())
Expand Down
6 changes: 3 additions & 3 deletions src/templates/common/encoding/article_bibtex.bib
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% load settings %}
{% load encoding %}
{% if article.journal.is_conference %}@conference{% else %}@article{% endif %}{% templatetag openbrace %}{{ article.journal.code }} {{ article.id }},
author = {{ article.author_list|latex_conform }},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 3 has me puzzled, could well be my lack of understanding, but here's my observation. Please ignore if it a misunderstanding or not relevant:

I read this as a change from an output described by templatetag openbrace journal.article.code articleid, to templatetag openbrace journalarticle.codearticleid, -> i.e. that the last two terms have been concatenated because the space between them has been removed.

Was that intended?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

marking as changes requested only in as far as asking you to consider this observation before merging.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the space makes thie field invalid.

{% if article.journal.is_conference %}@conference{% else %}@article{% endif %}{% templatetag openbrace %}{{ article.journal.code }}{{ article.id }},
author = {{ article.bibtex_author_list|latex_conform }},
title = {{ article.title|escape|latex_conform }},
volume = {{ article.issue.volume|latex_conform }},
year = {{ article.date_published.year|latex_conform }},
Expand All @@ -13,6 +13,6 @@ @conference{
{% if article.page_range %}pages = {{ article.page_range|latex_conform }},{% endif %}
{% if article.keywords.exists %}keywords = {{ article.keyword_list_str|escape|latex_conform }},{% endif %}
{% if article.journal_issn %}issn = {{ article.journal_issn|latex_conform }},{% endif %}
publisher={{ article.journal|setting:'publisher_name'|latex_conform }},
publisher ={{ article.journal|setting:'publisher_name'|latex_conform }},
journal = {{article.journal_title|latex_conform }}
}
16 changes: 10 additions & 6 deletions src/templates/common/encoding/article_ris.ris
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
{% load settings %}TY - {% if article.journal.is_conference %}CONF{% else %}JOUR{% endif %}
AB - {{ article.abstract|escape}}
AU - {{ article.author_list }}
DA - {{ article.date_published.year }}/{{article.date_published.month}}//
{% if article.get_doi %}DO - {{ article.get_doi }}{% endif %}
AB - {{ article.abstract|escape}}{% for author in article.frozen_authors.all %}
AU - {{ author.full_name }}{% endfor %}
PA - {{ article.date_published.year }}
DA - {{ article.date_published|date:"Y/m/d" }}
{% if article.get_doi %}DO - {{ article.get_doi }}{% endif %}
IS - {{ article.issue.issue }}
VL - {{ article.issue.volume }}
PB - {{ article.journal|setting:'publisher_name' }}
PY - {{ article.date_published.year }}
TI - {{ article.title|escape}}
T2 - {{ article.journal_title }}
UR - {{ article.url }}
ER -
UR - {{ article.url }}{% for keyword in article.keywords.all %}
KW - {{ keyword.word }}{% endfor %}
{% if article.first_page %}SP - {{ article.first_page }}{% endif %}
{% if article.last_page %}EP - {{ article.last_page }}{% endif %}
ER -