Created
June 20, 2018 12:38
-
-
Save willemarcel/b983c3a6a4db267fd43585123eb74349 to your computer and use it in GitHub Desktop.
hot website countries.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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 %} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment