mirror of
https://github.com/github/choosealicense.com
synced 2024-12-22 04:40:09 +01:00
use jsonify to build license json
This commit is contained in:
parent
74f0cbddc8
commit
33e00d098e
@ -5,24 +5,4 @@ comment: \
|
||||
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" %}
|
||||
{
|
||||
"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 %}
|
||||
]
|
||||
[{% for page in site.pages %}{% if page.layout == "license" %}{{ page | jsonify }}{% assign i = i | plus: 1 %}{% if i < count %},{% endif %}{% endif %}{% endfor %}]
|
||||
|
Loading…
x
Reference in New Issue
Block a user