templates/inc/table-of-content-articles.html.twig line 1

  1. {% set year = '' %}
    {% for article in articles %}
        {% set articleYear = article.publicationYear|default(article.publicationDate ? (article.publicationDate / 1000)|date("Y") : '') %}
        {% set hasPdf = article.pdf|default('')|trim != '' %}
        {% set hasPageStart = article.pageStart is not null and article.pageStart != '' %}
        {% set hasPageEnd = article.pageEnd is not null and article.pageEnd != '' %}
        {% set isNewPublishingArticle = not hasPdf %}
        {% set abstractHtml = article.abstract|default('')|replace({'<p>&nbsp;</p>': ""})|trim %}
        {% if articleYear and year != articleYear %}
            <h3>
                Table of Contents {{ articleYear }}
            </h3>
            {% set year = articleYear %}
        {% endif %}
        <div class="article">
            {% if isNewPublishingArticle %}
            {% if article.articleType.name|default(null) %}
            <p class="type">{{ article.articleType.name }}</p>
            {% endif %}
            {% if abstractHtml %}
                <div class="abstract-preview">
                    {{ abstractHtml|raw }}
                </div>
            {% endif %}
            <p><strong>{{ article.authorNames|join(', ') }}</strong></p>
    
            <div class="triggers">
                {% if article.abstract|default(null) %}
                    <a href="{{ absolute_url('/articles/') }}{{article.number}}">[Read More]</a>
                {% endif %}
                {% if article.pdf|default(null) %}
                    <a target="_blank" href="{{ absolute_url('/articles/pdf/') }}{{article.number}}?rev={{article.updated}}">[Download PDF]</a>
                {% endif %}
            </div>
            {% else %}
            {% if article.articleType.name|default(null) %}
            <p class="type">{{ article.articleType.name }}</p>
            {% endif %}
            {% if abstractHtml %}
                <div class="abstract-preview">
                    {{ abstractHtml|raw }}
                </div>
            {% endif %}
            <p><strong>{{ article.authorNames|join(', ') }}</strong></p>
            {% if hasPageStart or hasPageEnd %}
            <p>
                {% if hasPageStart and hasPageEnd %}
                Page: {{ article.pageStart }} - {{ article.pageEnd }}
                {% elseif hasPageStart %}
                Page: {{ article.pageStart }}
                {% else %}
                Page: {{ article.pageEnd }}
                {% endif %}
            </p>
            {% endif %}
    
            <div class="triggers">
                {% if article.abstract|default(null) %}
                    <a href="{{ absolute_url('/articles/') }}{{article.number}}">[Read More]</a>
                {% endif %}
                <a target="_blank" href="{{ absolute_url('/articles/pdf/') }}{{article.number}}?rev={{article.updated}}&view=inline">[View Full Text - PDF]</a>
                <a href="{{ absolute_url('/articles/pdf/') }}{{article.number}}?rev={{article.updated}}">[Download Full Text - PDF]</a>
            </div>
    
            {% if article.doi|default(null) %}
                <a class="doi" href="{{ absolute_url('/articles/pdf/') }}{{article.number}}?rev={{article.updated}}">{{article.doi}}</a>
            {% endif %}
            {% endif %}
        </div>
    {% endfor %}