-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpersons.json
More file actions
22 lines (21 loc) · 2.41 KB
/
persons.json
File metadata and controls
22 lines (21 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
---
layout: null
---
{
"nodes": [
{% for person in site.persons %}{% assign n = 0 %}{% assign years = "" %}{% for project in site.projects %} {% if project.related-persons contains person.name %} {% assign n=n | plus: 1 %} {% assign years = years | append: project.year | append: "/" %} {% endif %} {% endfor %}{"id": "{{ person.name | replace: ' ', '.' }}", "name": "{{ person.name }}", "type": "{{ person.type }}", "tagline": "{{ person.tagline | join: ', ' }}", "description": "{{ person.description }}", "related-persons": "{{ person.related-persons }}", "url": "{{ person.url }}", "nr_projects": "{{ n }}", "years": "{{ years }}" }{% unless forloop.last %},{% endunless %}
{% endfor %}],
{% capture list %}{% for project in site.projects %}{% assign persons = project.related-persons | split:", " | sort %}{% for person in persons %}{% assign i1 = forloop.index %}{% for p2 in persons %}{% assign i2 = forloop.index %}{% if i2 > i1 %}{{ person | replace: ' ', '.' }},{{ p2 | replace: ' ', '.' }},{{ project.name }},{{ project.year }},{{ project.tagline | escape }},{{ project.value }},{{ project.content }}1^{% endif %}{% endfor %}{% endfor %}{% endfor %}{% endcapture %}
{% assign thelist = list | split: "^" %}
{% capture links %}{% for item in thelist %}{% assign this = item | split: "," %}{% unless forloop.last %}{{this[0]}}|{{this[1]}}{% if forloop.rindex != 2 %}---{% endif %}{% endunless %}{% endfor %}{% endcapture %}
{% assign linksArray = links | split: "---" | sort %}{% capture editedLinks %}{% assign counter = 0 %}{% assign control = "" %}{% for link in linksArray %}{% assign thisLink = link | split: "|" %}{% if link != control %}{% assign counter2 = 0 %}{% assign counter3 = counter %}{% assign counter4 = counter3 | plus: 40 %}{% for i in (counter3..counter4) %}{% if link == linksArray[i] %}{% assign counter2 = counter2 | plus: 1 %}{% assign control = linksArray[i] %}{% endif %}{% endfor %}
{ "source": "{{thisLink[0] | strip }}", "target": "{{thisLink[1] | strip }}", "grade": "{{counter2}}" }{% unless forloop.last %},{% endunless %}{% endif %}{% assign counter = counter | plus: 1 %}{% endfor %}
{% endcapture %}
"links": [
{{editedLinks}}
],
"projects": [
{% for project in site.projects %}{"name": "{{ project.name }}", "start": "{{ project.year }}", "end": "{{ project.enddate }}", "relatedPersons": "{{ project.related-persons }}"}{% unless forloop.last %},{% endunless %}
{% endfor %}
]
}