diff --git a/journals/views.py b/journals/views.py index 432e6dc162641a77220292eb28ea14f78ed1d0cd..920a6da3e7c4f7159def9c22dcdb709df7454671 100644 --- a/journals/views.py +++ b/journals/views.py @@ -1315,3 +1315,29 @@ def publication_detail_pdf(request, doi_label): response['Content-Disposition'] = ('filename=' + publication.doi_label.replace('.', '_') + '.pdf') return response + + +###################### +# Feed DOIs to arXiv # +###################### + +""" +This method provides arXiv with the doi and journal ref of the 100 most recent +publications in the journal specified by doi_label. +""" +def arxiv_doi_feed(request, doi_label): + journal = get_object_or_404(Journal, doi_label=doi_label) + feedxml = ('<preprint xmlns="http://arxiv.org/doi_feed" ' + 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' + 'identifier="SciPost.org arXiv.org DOI feed" ' + 'version="DOI SnappyFeed v1.0" ' + 'xsi:schemaLocation="http://arxiv.org/doi_feed ' + 'http://arxiv.org/schemas/doi_feed.xsd">') + publications = Publication.objects.filter( + in_issue__in_volume__in_journal=journal).order_by('-publication_date')[:100] + for publication in publications: + feedxml += ('\n<article preprint_id="%s" doi="%s" journal_ref="%s" />' % ( + publication.arxiv_identifer_wo_vn_nr, publication.doi_string, + publication.citation())) + feedxml += '\n</preprint>' + return HttpResponse(feedxml, content_type='text/xml') diff --git a/scipost/urls.py b/scipost/urls.py index 9da0a19f216c11051b08f1b2064ccb6774057ea9..b1bb8f2df417d0a4e2f7e98a6ab4400dac360f13 100644 --- a/scipost/urls.py +++ b/scipost/urls.py @@ -207,6 +207,7 @@ urlpatterns = [ # Journal landing page url(r'^10.21468/%s' % JOURNAL_REGEX, journals_views.landing_page, name='landing_page'), url(r'^%s' % JOURNAL_REGEX, journals_views.landing_page, name='landing_page'), + url(r'^arxiv_doi_feed/%s' % JOURNAL_REGEX, journals_views.arxiv_doi_feed, name='arxiv_doi_feed'), ################ # Howto guides #