Skip to content

Commit

Permalink
trying to invent html
Browse files Browse the repository at this point in the history
  • Loading branch information
aguerrerolopez committed Mar 2, 2024
1 parent 065ffc8 commit 7d116e3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 25 deletions.
32 changes: 10 additions & 22 deletions _pages/cv.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,30 +51,18 @@ Work experience
Publications
======

{% assign sorted_publications = site.publications | sort: 'date' | reverse %}
{% assign last_year = "" %}
{% assign categories_order = "Peer-review Journals,Preprints,Conference Proceedings,Conference Abstracts,Datasets,Misc" | split: "," %}

{% for post in sorted_publications %}
{% capture current_year %}{{ post.date | date: "%Y" }}{% endcapture %}

{% unless year == current_year %}
{% assign year = current_year %}
{% if forloop.last %}
{% assign last_year = year %}
{% endif %}
<h3 class="year-toggle{% if year == last_year %} open{% endif %}">{{ year }} <span class="toggle-icon">+</span></h3>
<div id="publications-{{ year }}" class="publications-section{% if year == last_year %} open{% endif %}">
{% endunless %}

{% include archive-single-cv.html %}

{% if forloop.last %}
{% for category in categories_order %}
{% assign publications_in_category = site.publications | where: "category", category %}

{% if publications_in_category.size > 0 %}
<h3 class="category-toggle">{{ category | capitalize }} <span class="toggle-icon">+</span></h3>
<div id="publications-{{ category | slugify }}" class="publications-section">
{% for post in publications_in_category %}
{% include archive-single-cv.html %}
{% endfor %}
</div>
{% else %}
{% capture next_post_year %}{{ sorted_publications[forloop.index].date | date: "%Y" }}{% endcapture %}
{% if year != next_post_year %}
</div>
{% endif %}
{% endif %}
{% endfor %}

Expand Down
7 changes: 4 additions & 3 deletions _pages/publications.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@ author_profile: true
{% assign publications_in_category = site.publications | where: "category", category %}

{% if publications_in_category.size > 0 %}
<h2 class="category-toggle">{{ category | capitalize }} <span class="toggle-icon">+</span></h2>
<div id="publications-{{ category | slugify }}" class="publications-section">
<h2 class="category-toggle">{{ category | capitalize }} <span class="toggle-icon">+</span></h2>
<div id="publications-{{ category | slugify }}" class="publications-section"></div>
{% for post in publications_in_category %}
{% include archive-single.html %}
{% endfor %}
</div>

{% endif %}
{% endfor %}


<script>
var categoryToggles = document.querySelectorAll('.category-toggle');
categoryToggles.forEach(function(toggle) {
Expand Down

0 comments on commit 7d116e3

Please sign in to comment.