1
0
mirror of https://github.com/github/choosealicense.com synced 2024-11-10 21:48:53 +01:00
choosealicense.com/licenses.json

29 lines
1.1 KiB
JSON
Raw Normal View History

---
comment: \
2013-10-30 18:10:25 +01:00
because the for loop is being filtered by layout, the normal rindex0 check
2013-07-16 17:33:33 +02:00
for the trailing comma doesn't work. Count the number of licenses and manually
increment an index to see if we're on the true last iteration.
---
{% assign count = 0 %}{% for page in site.pages %}{% if page.layout == "license" %}{% assign count = count | plus: 1 %}{% endif %}{% endfor %}{% assign i = 0 %}
[
{% for page in site.pages %}{% if page.layout == "license" %}
{
2013-10-30 18:10:25 +01:00
"title": "{{ page.title }}",
"permalink": "{{ page.permalink }}",
"featured": {% if page.featured %}true{% else %}false{% endif %},
"description": "{{ page.description | replace: '"', '\"' }}",
"how": "{{ page.how | replace: '"', '\"' }}",
"rules": {
{% for category in site.rules %}
{% assign cat = category[0] %}
"{{ cat }}": [
{% for rule in page[cat] %}
"{{ rule }}"{% if forloop.rindex0 > 0 %},{% endif %}
{% endfor %}
]{% if forloop.rindex0 > 0 %},{% endif %}
{% endfor %}
}{% assign i = i | plus: 1 %}
}{% if i < count %},{% endif %}
{% endif %}{% endfor %}
2013-10-30 18:10:25 +01:00
]