templates/inc/pages/grammar.html (40 lines of code) (raw):
<div class="grammar" markdown="0">
{% for set in page.kotlinGrammar %}
<div class="grammar-items-set" data-file-name="{{ set.file-name }}">
{% for item in set.content %}
{% case item.type %}
{% when 'comment' %}
<div class="grammar-comment">
{% markdown %}{{ item.content }}{% endmarkdown %}
</div>
{% when 'item' %}
<div class="grammar-item">
{% for item in item.content %}
{% case item.type %}
{% when 'annotation' %}
<div class="grammar-annotation">{{ item.content }}</div>
{% when 'declaration' %}
<div class="grammar-declaration">
<div class="grammar-declaration-name" id="{{ item.name }}">{{ item.name }}</div>
{% if item.usages.size > 0 %}
<div class="grammar-declaration-usedby">
(used by
{% for usage in item.usages %}
<a href="#{{ usage.name }}">{{ usage.name }}</a>{% if forloop.last == false %},{% endif %}{% endfor %})
</div>
{% endif %}
</div>
{% when 'description' %}
{% if item.content.size > 0 %}
<div class="grammar-description">
{% for item in item.content %}{% case item.type %}{% when 'identifier' %}<a class="grammar-identifier-name" href="#{{ item.name }}">{{ item.name }}</a>{% when 'string' %}<span class="grammar-string">{{ item.content | escape }}</span>{% when 'symbol' %}<span class="grammar-symbol">{{ item.content }}</span>{% when 'other' %}<span class="grammar-other">{{ item.content }}</span>{% when 'whitespace' %}{{ item.content | replace:' ',' ' }}{% when 'crlf' %}<br>{% endcase %}{% endfor %}
</div>
{% endif %}
{% endcase %}
{% endfor %}
</div>
{% endcase %}
{% endfor %}
</div>
{% endfor %}
</div>