-
Notifications
You must be signed in to change notification settings - Fork 1
/
igs-json.html
45 lines (41 loc) · 1.22 KB
/
igs-json.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
---
permalink: /igs.json
layout: none
title: IG Test
note: outputs a json array of all the audience/interest groups listed in sessions.yml and defined in acronyms.yml
---
{% comment %}
First, get the list of IGs/Audience as an array
{% endcomment %}
{% assign igs = '' | split: ',' %}
{% for session in site.data.sessions %}
{% if session.audience.first %}
{% assign igs = igs | concat: session.audience %}
{% endif %}
{% endfor %}
{% assign igs = igs | uniq | sort_natural %}
{% comment %}
Second, get the list of acronyms from acronyms.yml
{% endcomment %}
{% assign acronyms = site.data.acronyms %}
{% comment %}
Finally, output the audience groups as a json file
{% endcomment %}
[
{% for ig in igs %}
{% assign igLabel = "" %}
{% for ac in acronyms %}
{% if ig == ac.short %}
{% assign igLabel = ig | append: ' (' | append: ac.display | append: ')' %}
{% endif %}
{% endfor %}
{% if igLabel == "" %}
{% assign igLabel = ig %}
{% endif %}
{
"id": "{{ig}}",
"label": "{{igLabel}}"
}
{% unless forloop.last %},{% endunless %}
{% endfor %}
]