Skip to content

Commit 35dca94

Browse files
committed
updated and cleaned up the papers logic
1 parent ae3c7aa commit 35dca94

3 files changed

Lines changed: 48 additions & 39 deletions

File tree

_includes/header.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ <h1>{{ site.title | escape }}</h1>
1515
{%- assign resolved_href = href | relative_url -%}
1616
{%- endif -%}
1717
<li>
18-
<a href="{{ resolved_href }}"{%- if item.id -%} id="{{ item.id }}"{%- endif -%}{%- if item.id == 'contact-toggle' -%} aria-controls="email-blockquote" aria-expanded="false"{%- endif -%}>{{ item.label }}</a>
18+
<a href="{{ resolved_href }}" {%- if item.id %} id="{{ item.id }}"{% endif -%} {%- if item.id == 'contact-toggle' %} aria-controls="email-blockquote" aria-expanded="false"{% endif -%}>{{ item.label }}</a>
1919
</li>
2020
{%- endfor -%}
2121
</ul>

_includes/papers.html

Lines changed: 45 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,48 @@
11
<section aria-label="Papers">
2-
{% for paper in site.data.papers %}
2+
{%- for paper in site.data.papers -%}
33
<article class="paper-item">
4-
· {% assign authors_count = paper.authors | size %}
5-
{% if authors_count > 0 %}
6-
{% for author in paper.authors %}
7-
{% if author.highlight %}<strong>{{ author.name }}</strong>{% else %}{{ author.name }}{% endif %}{% unless forloop.last %}, {% endunless %}
8-
{% endfor %}.
9-
{% endif %}
10-
11-
{% assign title = paper.title | strip %}
12-
{% assign title_last = title | slice: -1 %}
13-
{{ title }}{% unless title_last == '.' or title_last == '?' or title_last == '!' %}.{% endunless %} <em>{{ paper.venue }}</em>, {{ paper.year }}.
14-
15-
{% assign links_count = paper.links | size %}
16-
{% if links_count > 0 %} <sub><strong>
17-
{% for link in paper.links %}
18-
<a href="{{ link.url }}">{{ link.label }}</a>{% unless forloop.last %} · {% endunless %}
19-
{% endfor %}
20-
</strong></sub>{% endif %}
21-
22-
{% if paper.doi %} <sub class="citation"{% if paper.citation_id %} id="{{ paper.citation_id }}"{% endif %} data-doi="{{ paper.doi }}"></sub>{% endif %}
23-
24-
<sub><strong><code>{{ paper.type }}</code></strong></sub>
4+
·
5+
{%- assign authors_count = paper.authors | size -%}
6+
7+
{%- if authors_count > 0 -%}
8+
{%- for author in paper.authors -%}
9+
{%- if author.highlight -%}
10+
<strong>{{- author.name -}}</strong>
11+
{%- else -%}
12+
{{- author.name -}}
13+
{%- endif -%}
14+
{%- unless forloop.last -%}, {% endunless -%}
15+
{%- endfor -%}.
16+
{%- endif -%}
17+
18+
{%- assign title = paper.title | strip -%}
19+
{%- assign title_last = title | slice: -1 -%}
20+
21+
{{- title -}}
22+
{%- unless title_last == '.' or title_last == '?' or title_last == '!' -%}.{%- endunless -%}
23+
24+
<em>{{- paper.venue -}}</em>, {{- paper.year -}}.
25+
26+
{%- assign links_count = paper.links | size -%}
27+
28+
{%- if links_count > 0 -%}
29+
<sub><strong>
30+
{%- for link in paper.links -%}
31+
<a href="{{ link.url }}">{{- link.label -}}</a>
32+
{%- unless forloop.last -%} · {% endunless -%}
33+
{%- endfor -%}
34+
</strong></sub>
35+
{%- endif -%}
36+
37+
{%- if paper.doi -%}
38+
<sub
39+
class="citation"
40+
{%- if paper.citation_id -%} id="{{ paper.citation_id }}"{%- endif -%}
41+
data-doi="{{ paper.doi }}">
42+
</sub>
43+
{%- endif -%}
44+
45+
<sub><strong><code>{{- paper.type -}}</code></strong></sub>
2546
</article>
26-
{% endfor %}
27-
</section>
47+
{%- endfor -%}
48+
</section>

assets/script.js

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,11 @@ document.addEventListener("DOMContentLoaded", () => {
3535
}
3636
});
3737

38-
// Update total + h-index (prefer precomputed values from citations.json)
38+
// Update total + h-index
3939
if (totalDisplay) {
4040
const totalFromJson = Number(data._total_citations);
4141
const hIndexFromJson = Number(data._h_index);
42-
43-
if (Number.isFinite(totalFromJson) && Number.isFinite(hIndexFromJson)) {
44-
totalDisplay.textContent = `‒ CITATIONS: ${totalFromJson} · H-INDEX: ${hIndexFromJson} ‒`;
45-
} else if (citationCounts.length) {
46-
const sorted = citationCounts.slice().sort((a, b) => b - a);
47-
let hIndex = 0;
48-
for (let i = 0; i < sorted.length; i++) {
49-
if (sorted[i] >= i + 1) hIndex = i + 1;
50-
else break;
51-
}
52-
const total = citationCounts.reduce((a, b) => a + b, 0);
53-
totalDisplay.textContent = `‒ CITATIONS: ${total} · H-INDEX: ${hIndex} ‒`;
54-
}
42+
totalDisplay.textContent = `‒ CITATIONS: ${totalFromJson} · H-INDEX: ${hIndexFromJson} ‒`;
5543
}
5644

5745
const yearsData = data._yearly_totals;

0 commit comments

Comments
 (0)