Skip to content

Commit

Permalink
Tring to fix publication lists
Browse files Browse the repository at this point in the history
  • Loading branch information
oshadura committed Jan 8, 2025
1 parent 18635d6 commit 4bcf2b0
Show file tree
Hide file tree
Showing 13 changed files with 110 additions and 3 deletions.
2 changes: 2 additions & 0 deletions _data/publications/2598292.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
inspire-id: 2598292
project:
- agc
challenge-area:
- agc
2 changes: 2 additions & 0 deletions _data/publications/2738557.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
inspire-id: 2738557
project:
- agc
challenge-area:
- agc
2 changes: 2 additions & 0 deletions _data/publications/2743013.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
inspire-id: 2743013
project:
- agc
challenge-area:
- agc
2 changes: 2 additions & 0 deletions _data/publications/2743608.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
inspire-id: 2743608
project:
- agc
challenge-area:
- agc
2 changes: 2 additions & 0 deletions _data/publications/oshadura-alheld-agc-acat2022.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ focus-area:
- doma
- as
project: agc
challenge-area:
- agc
1 change: 0 additions & 1 deletion _layouts/challenge-area.html
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ <h2 class="alt-h2 text-center mb-3 mt-lg-6" id="join-us">Join us</h2>
</div>
</div>
</section>

</main>
</div>
{% include_cached footer.html %}
Expand Down
2 changes: 2 additions & 0 deletions _layouts/presentations.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
Presentations:
<a href="/presentations/byarea.html">by area</a>
&#8226;
<a href="/presentations/bychallenge.html">by challenge</a>
&#8226;
<a href="/presentations/byinstitution.html">by institution</a>
&#8226;
<a href="/presentations/bymonth.html">by date</a>
Expand Down
2 changes: 2 additions & 0 deletions _plugins/checkpres.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def generate(site)
msg = "presentation ##{index} in _data/people/#{name}.yml"

ensure_array(presentations[index], 'focus-area')
ensure_array(presentations[index], 'challenge-area')
ensure_array(presentations[index], 'project')

local_fa = pres_hash['focus-area']&.to_set
Expand All @@ -31,6 +32,7 @@ def generate(site)
presentation.key 'meetingurl', :optional
presentation.key 'location', :optional
presentation.key 'focus-area', :optional, set: focus_areas
presentation.key 'challenge-area', :optional, set: challenge_areas
presentation.key 'project', :optional, set: projects unless local_fa && local_fa < projectless

presentation.print_warnings
Expand Down
5 changes: 4 additions & 1 deletion _plugins/checkpubs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@ def generate(site)
msg = "Publication in _data/publications/#{name}.yaml"

ensure_array(pub_hash, 'focus-area')
ensure_array(pub_hash, 'challenge-area')
ensure_array(pub_hash, 'project')

local_fa = pub_hash['focus-area']&.to_set
local_ca = pub_hash['challenge-area']&.to_set
projectless = site.config['iris-hep']['projectless-focus-areas'].to_set

publication = Record.new(msg, pub_hash)
publication.key 'focus-area', set: focus_areas if pub_hash.key? 'focus-area'
publication.key 'project', :optional, set: projects unless local_fa && local_fa < projectless
publication.key 'challenge-area', set: focus_areas if pub_hash.key? 'challenge-area'
publication.key 'project', :optional, set: projects unless local_fa && local_fa < projectless && local_ca && local_ca < projectless

publication.print_warnings
end
Expand Down
29 changes: 28 additions & 1 deletion _plugins/getpub.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ def submitted_to(pub, name)
end
end

# Setup a publication - adds/fixes focus-area and project
# Setup a publication - adds/fixes focus-area, challenge-area and project
def prepare(pub, name)
pub['focus-area'] ||= []
pub['challenge-area'] ||= []
pub['project'] ||= []
pub['filename'] = name

Expand All @@ -102,12 +103,22 @@ def prepare(pub, name)
# Looks up focus areas from projects
prepare_focus_area(pub, name) if pub['focus-area'].empty?

# Looks up challenge areas from projects
prepare_challenge_area(pub, name) if pub['challenge-area'].empty?

# Make sure the focus-area is a list
force_array(pub, 'focus-area')

# Make sure the challenge-area is a list
force_array(pub, 'challenge-area')

# Make sure there is a focus-area
msg = "Publication #{name} must contain a focus-area or project"
raise StandardError, msg if pub['focus-area'].empty?

# Make sure there is a challenge-area
msg = "Publication #{name} must contain a challenge-area or project"
raise StandardError, msg if pub['challenge-area'].empty?
end

# Setup a publication - ensures open-science-cat is valid
Expand Down Expand Up @@ -143,6 +154,22 @@ def prepare_focus_area(pub, name)
pub['focus-area'].uniq!
end

# Add challenge areas based on projects
def prepare_challenge_area(pub, name)
pub['project'].each do |p|
pg = @site.pages.detect { |page| page.data['shortname'] == p }
msg = "Project #{pub['project']} missing! Cannot find challenge-area for #{name}."
raise msg unless pg

new_fas = pg.data['challenge-area']
new_fas = [new_fas] if new_fas.is_a? String
pub['challenge-area'] += new_fas unless new_fas.nil?
end

# Don't list the same challenge area multiple times
pub['challenge-area'].uniq!
end

# Join the first N names, add et. all. if truncated
def join_names(names)
return names[0] if names.length == 1
Expand Down
1 change: 1 addition & 0 deletions _scripts/get_pub.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def summarize_record(recid : int, *, max_authors : int = 5):

mini_dict.update({
'focus-area': '<FILL IN>',
'challenge-area': '<FILL IN>',
'project': '<FILL IN>',
})

Expand Down
15 changes: 15 additions & 0 deletions _scripts/publication.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
"focus-area": {
"$ref": "#/definitions/focus_areas"
},
"challenge-area": {
"$ref": "#/definitions/challenge_areas"
},
"title": { "type": "string" },
"date": { "type": "string", "format": "date" },
"citation": { "type": "string" },
Expand Down Expand Up @@ -50,6 +53,18 @@
{ "type": "array", "items": { "$ref": "#/definitions/focus_area" } }
]
},
"challenge_area": {
"enum": [
"agc"
]
},
"challenge_areas": {
"oneOf": [
{ "type": "null" },
{ "$ref": "#/definitions/challenge_area" },
{ "type": "array", "items": { "$ref": "#/definitions/challenge_area" } }
]
},
"string_or_array": {
"oneOf": [
{ "type": "null" },
Expand Down
48 changes: 48 additions & 0 deletions pages/presentations/bychallenge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
permalink: /presentations/bychallenge.html
layout: presentations
title: Presentations by Challenge
---

{% assign sorted_presentations = site.data['sorted_presentations'] %}

<!--
0 1 2 3 4 5 6 7 8
date | name | title | url | meeting | meetingurl | project | challenge_area | institution
-->

<h2>Presentations by the IRIS-HEP team</h2>
{% assign prescount = 0 %}

{% assign activities = site.pages | where: "layout", "challenge-area" | where_exp: "item", "item.draft != true" | sort_natural: 'title' %}

{% for challenge-area-page in activities %}
{% assign challenge-area-title = challenge-area-page.title %}
{% assign challenge-area-name = challenge-area-page.name | basename %}
<h4>{{ challenge-area-title }}</h4>
<ul>
{% for talk in sorted_presentations %}
{% if talk.challenge-area contains challenge-area-name %}
<li>
{%- include print_pres.html talk=talk -%}
</li>
{% assign prescount = prescount | plus: "1" %}
{% endif %}
{% endfor %}
</ul>
{% endfor %}


<h4>General</h4>
<ul>
{% for talk in sorted_presentations %}
{% if talk.challenge-area == nil %}
<li>
{%- include print_pres.html talk=talk -%}
</li>
{% assign prescount = prescount | plus: "1" %}
{% endif %}
{% endfor %}
</ul>

Total presentations (presentations spanning multiple areas listed multiple times): {{ prescount }}.

0 comments on commit 4bcf2b0

Please sign in to comment.