diff --git a/convert.py b/convert.py index 9cfe51b..f76512c 100644 --- a/convert.py +++ b/convert.py @@ -13,6 +13,8 @@ MEMORY_LIMIT_ARG = ['+RTS', '-M256M', '-RTS'] PANDOC_CMD = ['pandoc'] LATEX = ['--pdf-engine=xelatex'] +GEOMETRY = ['-V', 'geometry:margin=1in'] +COVER_SHEET_STYLE = ['-V', 'mainfont=Arial', '-V', 'pagestyle=empty'] def generate_pdf_cover_sheet(cover_sheet_content, context): @@ -43,6 +45,8 @@ def generate_pdf_cover_sheet(cover_sheet_content, context): PANDOC_CMD + MEMORY_LIMIT_ARG + LATEX + + GEOMETRY + + COVER_SHEET_STYLE + ['-s', cover_sheet_html_path, '-t', 'pdf', '-o', cover_sheet_pdf_path, f'--resource-path={media_dir}'] ) try: @@ -81,6 +85,7 @@ def generate_pdf_from_doc(file): PANDOC_CMD + MEMORY_LIMIT_ARG + LATEX + + GEOMETRY + ['-s', file_path, '-t', 'pdf', '-o', out_path] ) diff --git a/iso_utils.py b/iso_utils.py index c7197c6..1a49a0f 100644 --- a/iso_utils.py +++ b/iso_utils.py @@ -100,6 +100,14 @@ def publish_repository_object_from_journal_article(article, repository, file): file=preprint_file, ) + for author in article.frozen_authors(): + repo_models.PreprintAuthor.objects.get_or_create( + preprint=preprint, + account=author.author, + order=author.order, + affiliation=author.affiliation, + ) + if article.preprint.repository.crossref_enable: preprints.deposit_doi_for_preprint_version( repository=article.preprint.repository, @@ -127,14 +135,6 @@ def publish_repository_object_from_journal_article(article, repository, file): preprint.submission_file = preprint_file preprint.save() - for author in article.frozen_authors(): - repo_models.PreprintAuthor.objects.get_or_create( - preprint=preprint, - account=author.author, - order=author.order, - affiliation=author.affiliation - ) - def recreate_version_file(article, version, file): file_path = get_pdf_path(article.journal, article, file) @@ -205,4 +205,3 @@ def publish_new_preprint_version(article, file): # Update the version with the final file version.file = preprint_file version.save() - diff --git a/templates/isolinear/clarity/full_preprint_list.html b/templates/isolinear/clarity/full_preprint_list.html new file mode 100644 index 0000000..39310eb --- /dev/null +++ b/templates/isolinear/clarity/full_preprint_list.html @@ -0,0 +1,77 @@ +{% extends "core/base.html" %} +{% load static %} +{% load i18n %} + +{% block title %}{% trans "Full Preprint List" %}{% endblock %} + +{% block body %} +
+
+

{% trans "Full Preprint List" %}

+

{% trans "A complete record of all preprints submitted to this journal, including those currently under review, those that have been accepted and published, and those that have been declined or withdrawn." %}

+
+
+
+ {% include "elements/sorting.html" with form_id=facet_form.id %} + {% for article in article_list %} +
+
+

+ {% if article.preprint.preprintversion_set.first %} + {{ article.safe_title }} + {% else %} + {{ article.safe_title }} + {% endif %} +

+ {% if article.date_declined or article.stage == 'Rejected' %} + {% trans "Declined" %} + {% elif not article.date_published and article.stage != 'preprint_published' and article.stage != 'Published' %} + {% trans "Under Review" %} + {% endif %} +
+ + {% if article.frozen_authors.all %} +

+ {% for author in article.frozen_authors.all %} + {{ author.full_name }}{% if not forloop.last %}, {% endif %} + {% endfor %} +

+ {% endif %} + +

+ {% if article.preprint.date_published %} + {% trans "First posted" %}: {{ article.preprint.date_published|date:"j F Y" }} + {% endif %} + {% if article.date_accepted %} +  ·  {% trans "Accepted" %}: {{ article.date_accepted|date:"j F Y" }} + {% endif %} + {% if article.date_published %} +  ·  {% trans "Published" %}: {{ article.date_published|date:"j F Y" }} + {% endif %} + {% if article.date_declined %} +  ·  {% trans "Declined" %}: {{ article.date_declined|date:"j F Y" }} + {% endif %} +

+ + {% with versions=article.preprint.preprintversion_set.all %} + {% if versions %} +

+ {% trans "Versions" %}: + {% for version in versions %} + v{{ version.version }}{% if not forloop.last %}, {% endif %} + {% endfor %} +

+ {% endif %} + {% endwith %} +
+ {% empty %} +

{% trans "No preprints to display." %}

+ {% endfor %} + {% include "elements/pagination.html" with form_id=facet_form.id %} +
+
+
+ {% include "elements/journal/article_list_filters.html" %} +
+
+{% endblock body %} diff --git a/templates/isolinear/clarity/preprint_version.html b/templates/isolinear/clarity/preprint_version.html new file mode 100644 index 0000000..63f8fe9 --- /dev/null +++ b/templates/isolinear/clarity/preprint_version.html @@ -0,0 +1,215 @@ +{% extends "core/base.html" %} +{% load static %} +{% load hooks %} +{% load i18n %} +{% load dates %} + +{% block page_title %}{% if article.preprint %}{% trans "Preprint" %} {% endif %}{% trans "Article" %}{% endblock %} + +{% block title %}{{ article.frozen_authors.0.last_name|striptags }} | {% if preprint_version.title %}{{ preprint_version.title|striptags }}{% else %}{{ article.title|striptags }}{% endif %} | {{ journal_settings.general.journal_name|striptags }}{% endblock %} + +{% block head %} + {% include "elements/article_meta_tags.html" %} +{% endblock %} + +{% block reading_options_bar %} + {% include "common/elements/journal/reading_options_bar.html" %} +{% endblock reading_options_bar %} + +{% block body %} +
+ {% if not journal_settings.article.disable_article_large_image %} +
+
+
+ {{ article.best_large_image_alt_text }} +
+
+
{{ article.section.name }}
+

{% if preprint_version.title %}{{ preprint_version.title|safe }}{% else %}{{ article.title|safe }}{% endif %}

+ {% include "elements/journal/article_authors_compact.html" with limit=10 %} +
+
+
+ {% endif %} +
+ +
+ +
+
+ {% if journal_settings.article.disable_article_large_image %} + {{ article.section.name }} +

{% if preprint_version.title %}{{ preprint_version.title|safe }}{% else %}{{ article.title|safe }}{% endif %}

+ {% endif %} + +
+ {% if article.is_published %} + {% blocktrans with version=preprint_version.version %}This is version {{ version }} of this article. The published version can be found at:{% endblocktrans %} + {% if article.get_doi %} + {{ article.get_doi_url }} + {% else %} + {% site_url 'article_view' 'id' article.pk %} + {% endif %} + {% elif preprint_version == article.preprint.current_version %} + {% blocktrans with version=preprint_version.version %}This is version {{ version }} of this article. It is the latest version of this preprint.{% endblocktrans %} + {% else %} + {% blocktrans with version=preprint_version.version %}This is version {{ version }} of this article. A newer version is available at:{% endblocktrans %} + {% if preprint_version.get_doi %} + https://doi.org/{{ preprint_version.preprint.current_version.get_doi }} + {% else %} + {% site_url 'isolinear_preprint_version' article.pk preprint_version.preprint.current_version.version %} + {% endif %} + {% endif %} +
+ + {% if journal_settings.general.uses_isolinear_plugin and not article.is_published %} +

+ + {% if article.date_accepted %} + {% trans "This article is an accepted preprint. Production is underway." %} + {% elif article.date_declined %} + {% trans "This article is a preprint that has been withdrawn from submission." %} + {% elif article.stage == 'Under Revision' %} + {% trans "This article is a preprint currently under revision." %} + {% else %} + {% trans "This article is a preprint and is currently undergoing peer review." %} + {% endif %} + +

+ {% endif %} + + {% if article.abstract and article.abstract != '' %} +

{% trans "Abstract" %}

+ {% if journal_settings.general.uses_isolinear_plugin and not article.is_published %} +

{{ article.abstract|safe }}

+ {% else %} +

{{ article.abstract_display|safe }}

+ {% endif %} + {% endif %} + + {% if journal_settings.general.keyword_list_page %} + {% include "elements/journal/article_keywords.html" with keywords=article.keywords linked="True" %} + {% else %} + {% include "elements/journal/article_keywords.html" with keywords=article.keywords %} + {% endif %} + + {% if article.rights %} +

{% trans "Rights" %}

+

{{ article.rights|safe }}

+ {% endif %} + + {% include "elements/funder_info_for_readers.html" %} + + {% hook 'article_content' %} +
+
+ +
+
+
+
+
+ {% include "common/elements/altmetric_badges.html" with article=article %} + {% if journal_settings.article.disable_article_large_image %} +

+ {% blocktrans count counter=article.frozen_authors.count %} + Author + {% plural %} + Authors + {% endblocktrans %} +

+ {% include "common/elements/journal/article_authors_ul.html" %} + {% endif %} + +

{% trans "Author details" %}

+ {% include "common/elements/journal/article_authors_full.html" %} + +

{% trans "Download" %}

+ + +

{% trans "Versions" %}

+ {% hook 'preprint_version_downloads' %} + +

{% trans "Information" %}

+
    + {% if journal_settings.article.display_date_submitted and article.date_submitted %} +
  • {% trans "Submitted on" %} {{ article.date_submitted|date_human }}
  • + {% endif %} + {% if journal_settings.article.display_date_accepted and article.date_accepted %} +
  • {% trans "Accepted on" %} {{ article.date_accepted|date_human }}
  • + {% endif %} + {% if article.is_published %} +
  • + {% trans "Published on" %} {{ article.date_published|date_human }} +
  • + {% endif %} + {% if journal_settings.general.uses_isolinear_plugin and not article.is_published %} +
  • {% trans "Preprint Under Review" %}
  • + {% elif article.peer_reviewed %} +
  • {% trans "Peer Reviewed" %} + +
  • + {% endif %} + {% if article.license %} +
  • {% trans "Licence" %} + + {{ article.license.name }} + {% include "elements/icons/link_external.html" %} + +
  • + {% endif %} +
+ + {% if article.competing_interests %} +

{% trans "Competing Interests" %}

+
    +
  • {{ article.competing_interests|safe }}
  • +
+ {% endif %} + + {% for field in article.custom_fields %} +

{% trans field.field.name %}

+

{{ field.answer|safe }}

+ {% endfor %} + + {% if article.public_reviews.count > 0 %} +

{% trans "Open Peer Reviews" %}

+ + {% endif %} +
+ {% hook 'article_sidebar' %} +
+
+
+
+
+ + {% include "elements/public_reviews.html" %} + +{% endblock body %} + +{% block js %} + + {% hook 'article_js_block' %} + +{% endblock js %} diff --git a/templates/isolinear/clean/full_preprint_list.html b/templates/isolinear/clean/full_preprint_list.html new file mode 100644 index 0000000..aed1da1 --- /dev/null +++ b/templates/isolinear/clean/full_preprint_list.html @@ -0,0 +1,94 @@ +{% extends "core/base.html" %} +{% load static %} +{% load i18n %} + +{% block title %}{% trans "Full Preprint List" %}{% endblock %} + +{% block body %} +
+
+
+ + +

{% trans "Full Preprint List" %}

+

{% trans "A complete record of all preprints submitted to this journal, including those currently under review, those that have been accepted and published, and those that have been declined or withdrawn." %}

+ + {% include "common/elements/sorting.html" with form_id=facet_form.id %} + + {% for article in article_list %} +
+
+
+

+ {% if article.preprint.preprintversion_set.first %} + {{ article.safe_title }} + {% else %} + {{ article.safe_title }} + {% endif %} +

+ {% if article.date_declined or article.stage == 'Rejected' %} + {% trans "Declined" %} + {% elif not article.date_published and article.stage != 'preprint_published' and article.stage != 'Published' %} + {% trans "Under Review" %} + {% endif %} +
+ +

+ {% for author in article.frozen_authors.all %} + {{ author.full_name }}{% if not forloop.last %}, {% endif %} + {% endfor %} +

+ +

+ {% if article.preprint.date_published %} + {% trans "First posted" %}: {{ article.preprint.date_published|date:"j F Y" }} + {% endif %} + {% if article.date_accepted %} +  ·  {% trans "Accepted" %}: {{ article.date_accepted|date:"j F Y" }} + {% endif %} + {% if article.date_published %} +  ·  {% trans "Published" %}: {{ article.date_published|date:"j F Y" }} + {% endif %} + {% if article.date_declined %} +  ·  {% trans "Declined" %}: {{ article.date_declined|date:"j F Y" }} + {% endif %} +

+ + {% with versions=article.preprint.preprintversion_set.all %} + {% if versions %} +

+ {% trans "Versions" %}: + {% for version in versions %} + v{{ version.version }}{% if not forloop.last %}, {% endif %} + {% endfor %} +

+ {% endif %} + {% endwith %} +
+
+ {% empty %} +

{% trans "No preprints to display." %}

+ {% endfor %} + + {% include "common/elements/pagination.html" with form_id=facet_form.id %} +
+ + +
+
+{% endblock body %} diff --git a/templates/isolinear/version_downloads.html b/templates/isolinear/version_downloads.html index a53ddc3..fbc41b3 100644 --- a/templates/isolinear/version_downloads.html +++ b/templates/isolinear/version_downloads.html @@ -10,7 +10,7 @@
  •   Version {{ version.version }}{% if version == preprint.current_version and not preprint.article.is_published %} (Latest Version) {% endif %}
    - + Download Version PDF
    diff --git a/views.py b/views.py index 82a079a..d8a7135 100644 --- a/views.py +++ b/views.py @@ -1,4 +1,5 @@ from django.shortcuts import render, reverse, redirect, get_object_or_404 +from django.template.loader import select_template from django.contrib import messages from django.utils import timezone from django.utils.translation import gettext_lazy as _ @@ -258,6 +259,17 @@ class PreprintArticlesListView(FilteredArticlesListView): template_name = 'journal/article_list.html' + def get_template_names(self): + theme = setting_handler.get_setting( + 'general', + 'journal_theme', + self.request.journal, + ).value + return [ + 'isolinear/{}/full_preprint_list.html'.format(theme), + self.template_name, + ] + def get_queryset(self, params_querydict=None): self.queryset = super().get_queryset(params_querydict) @@ -326,7 +338,15 @@ def preprint_version(request, article_id, version_number): setting_name='isolinear_repository_code', journal=request.journal, ).value - template = 'journal/preprint_version.html' + theme = setting_handler.get_setting( + 'general', + 'journal_theme', + request.journal, + ).value + template = select_template([ + 'isolinear/{}/preprint_version.html'.format(theme), + 'journal/preprint_version.html', + ]).template.name context = { 'article': article, 'preprint_version': preprint_version,