forked from hotosm/hotosm-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
countries.json
5 lines (4 loc) · 1.93 KB
/
countries.json
1
2
3
4
5
---
layout:
---
{% capture countries_list %}{% for country in site.where-we-work %}{{ country.title }}:: {% for project in site.projects %}{% if project.Country contains country.title %}{% if project['Impact Area'].size > 1 %} |{{ project['Impact Area'] | join: ',' }}| {% else %} |{{ project['Impact Area'] }}| {% endif %}{% endif %}{% if forloop.last == true %}; {% endif %}{% endfor %}{% endfor %}{% endcapture %}{% assign countries_array = countries_list | split: ';' %}{ {% for country in site.where-we-work %} "{{ country.title | downcase }}": { "continent":"{{ country.continent }}", "hot_program":{% for project in site.projects %}{% if project.Country contains country.title %}true{% break %}{% elsif forloop.last %}false{% endif %}{% endfor %}, "community_program":{% for project in site.projects %}{% if country.names contains project.Country and project['Is Community-Led'] %}true{% break %}{% elsif forloop.last %}false{% endif %}{% endfor %}, {% for item in countries_array %}{% assign country_impact_list = item | split: '::' %}{% assign impact_list = country_impact_list[1] | split: '|' %}{% assign country_name = country_impact_list[0] %}{% if country_impact_list[0] contains country.title %}{% assign impacts = impact_list | split: ',' %}{% assign pushed = ", " | split: ',' %}{% for impact_item in impacts %}{% if impact_item == "" and impact_item contains "\n" %}{% else %}{% if impact_item contains '[' or impact_item contains ']' %}{% else %}{% assign to_push = impact_item | remove: '"'| lstrip | rstrip | remove:"\n" %}{% if pushed contains to_push %}{% else %}{% assign pushed = pushed | push: to_push %}{% if to_push.size < 100 %} "{{ to_push }}": true, {% endif %}{% endif %}{% endif %}{% endif %}{% endfor %}{% endif %}{% endfor %} "member": {% for person in site.people %}{% if country.names contains person.Country %}true{% break %}{% elsif forloop.last %}false{% endif %}{% endfor %} }{% unless forloop.last %},{% endunless %}{% endfor %} }