Skip to content

Commit

Permalink
Unify paper list code for sxs-papers and spec pages
Browse files Browse the repository at this point in the history
  • Loading branch information
duetosymmetry committed Jan 4, 2025
1 parent cf98eec commit 2caafc2
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 75 deletions.
44 changes: 44 additions & 0 deletions _includes/paper-list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{%- assign sorted = site.papers | sort: 'date' -%}
{%- if include.filter_field -%}
{%- assign sorted = sorted | where: include.filter_field, "true" -%}
{%- endif -%}

<div id="year_link">
{% capture written_year %}'None'{% endcapture %}
{%- assign paper_count = 0 -%}
{%- for paper in sorted reversed %}
{%- assign paper_count = paper_count|plus:1 -%}
{% capture year %}{{ paper.date | date: '%Y' }}{% endcapture %}
{% if year != written_year %}
<a href="#{{ year }}">{{ year }}</a>
{% endif %}
{% capture written_year %}{{ year }}{% endcapture %}
{%- endfor -%}
</div>

{% capture written_year %}'None'{% endcapture %}
{%- for paper in sorted reversed %}
{% capture year %}{{ paper.date | date: '%Y' }}{% endcapture %}
{% if year != written_year %}
<h2 id="{{ year | slugify }}" class="paper_year"><a href="#{{ year | slugify }}">#{{ year }}</a></h2>
{% endif %}
{% capture written_year %}{{ year }}{% endcapture %}
<div class="paper">
<h3>{%- if include.numbered -%}{{ paper_count }}. {% endif %}{{ paper.title }}</h3>
{%- assign paper_count = paper_count|minus:1 -%}
<p class="paper_authors">{{ paper.authors | join: ", "}}</p>
{% if paper.jref %}
<p class="paper_jref">
{% if paper.doi %}<a href="http://dx.doi.org/{{ paper.doi }}">{% endif %}{{ paper.jref }}{% if paper.doi %}</a>{% endif %}
</p>
{% endif %}
<p class="paper_arxiv"><i class="ai ai-arxiv"></i>
[<a href="https://arxiv.org/abs/{{ paper.arxiv }}">arXiv:{{ paper.arxiv }}</a>]</p>
{%- unless include.suppress_abstracts -%}
<details>
<summary>Abstract</summary>
<div class="paper_abstract">{{ paper.abstract }}</div>
</details>
{%- endunless -%}
</div>
{%- endfor -%}
43 changes: 4 additions & 39 deletions for-researchers/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,43 +157,8 @@ The following publications have made use of SpEC. For their abstracts
and additional papers, see the [SXS Papers page]({{ site.baseurl }}{%
link for-researchers/sxs-papers.markdown %}).

<!-- Lots of code duplication between this and sxs-papers.markdown!!! -->
<div id="year_link">
{% capture written_year %}'None'{% endcapture %}
{%- assign sorted = site.papers | sort: 'date' -%}
{%- assign paper_count = 0 -%}
{%- for paper in sorted reversed %}
{% if paper.used_spec %}
{%- assign paper_count = paper_count|plus:1 -%}
{% capture year %}{{ paper.date | date: '%Y' }}{% endcapture %}
{% if year != written_year %}
<a href="#{{ year }}">{{ year }}</a>
{% endif %}
{% capture written_year %}{{ year }}{% endcapture %}
{% endif %}
{%- endfor -%}
</div>

{% capture written_year %}'None'{% endcapture %}
{%- assign sorted = site.papers | sort: 'date' -%}
{%- for paper in sorted reversed %}
{% if paper.used_spec %}
{% capture year %}{{ paper.date | date: '%Y' }}{% endcapture %}
{% if year != written_year %}
<h2 id="{{ year | slugify }}" class="paper_year"><a href="#{{ year | slugify }}">#{{ year }}</a></h2>
{% endif %}
{% capture written_year %}{{ year }}{% endcapture %}
<div class="paper">
<h3>{{ paper_count }}. {{ paper.title }}</h3>
{%- assign paper_count = paper_count|minus:1 -%}
<p class="paper_authors">{{ paper.authors | join: ", "}}</p>
{% if paper.jref %}
<p class="paper_jref">
{% if paper.doi %}<a href="http://dx.doi.org/{{ paper.doi }}">{% endif %}{{ paper.jref }}{% if paper.doi %}</a>{% endif %}
</p>
{% endif %}
<p class="paper_arxiv"><i class="ai ai-arxiv"></i>
[<a href="https://arxiv.org/abs/{{ paper.arxiv }}">arXiv:{{ paper.arxiv }}</a>]</p>
</div>
{% endif %}
{%- endfor -%}
{% include paper-list.html
numbered=true
filter_field="used_spec"
suppress_abstracts=true %}
37 changes: 1 addition & 36 deletions for-researchers/sxs-papers.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,4 @@ date: 2013-04-16 01:37:02.000000000 +00:00

Numerical Relativity papers published by members of the SXS Collaboration in reverse chronological order.

<div id="year_link">
{% capture written_year %}'None'{% endcapture %}
{%- assign sorted = site.papers | sort: 'date' -%}
{%- for paper in sorted reversed %}
{% capture year %}{{ paper.date | date: '%Y' }}{% endcapture %}
{% if year != written_year %}
<a href="#{{ year }}">{{ year }}</a>
{% endif %}
{% capture written_year %}{{ year }}{% endcapture %}
{%- endfor -%}
</div>

{% capture written_year %}'None'{% endcapture %}
{%- assign sorted = site.papers | sort: 'date' -%}
{%- for paper in sorted reversed %}
{% capture year %}{{ paper.date | date: '%Y' }}{% endcapture %}
{% if year != written_year %}
<h2 id="{{ year | slugify }}" class="paper_year"><a href="#{{ year | slugify }}">#{{ year }}</a></h2>
{% endif %}
{% capture written_year %}{{ year }}{% endcapture %}
<div class="paper">
<h3>{{ paper.title }}</h3>
<p class="paper_authors">{{ paper.authors | join: ", "}}</p>
{% if paper.jref %}
<p class="paper_jref">
{% if paper.doi %}<a href="http://dx.doi.org/{{ paper.doi }}">{% endif %}{{ paper.jref }}{% if paper.doi %}</a>{% endif %}
</p>
{% endif %}
<p class="paper_arxiv"><i class="ai ai-arxiv"></i>
[<a href="https://arxiv.org/abs/{{ paper.arxiv }}">arXiv:{{ paper.arxiv }}</a>]</p>
<details>
<summary>Abstract</summary>
<div class="paper_abstract">{{ paper.abstract }}</div>
</details>
</div>
{%- endfor -%}
{% include paper-list.html numbered=false %}

0 comments on commit 2caafc2

Please sign in to comment.