added actual documentation and README
[sgn.git] / docs / _includes / navigation.html
blob322b0851096f7e2c64965f35a59686934e1d7181
1 <!-- modifed from https://gist.github.com/kasperisager/9416313 -->
2 {% capture html %}
3 <ul class="nav-tree">
4 {% assign entries = site.pages | sort: "path" %}
5 {% for entry in entries %}
6 {% capture slug %}{{ entry.url | split: "/" | last }}{% endcapture %}
7 {% capture current %}{{ entry.url | remove: slug | replace: "//", "/" }}{% endcapture %}
8 {% if current==entry.url %} {% assign current = "_ROOT" %} {% endif %}
9 {% if current == include.context %}
10 <li>
11 {% if page.url == entry.url %}<strong>{% elsif page.url contains entry.url %}<em>{% endif %}
12 <a href="{{ site.baseurl }}{{ entry.url }}">{{ entry.title }}</a>
13 {% if page.url == entry.url %}</strong>{% elsif page.url contains entry.url %}</em>{% endif %}
14 {% assign ccon = entry.content | stringify%}
15 {% if ccon contains '<input type="hidden" toc="start" />' %}
16 {% assign toc = ccon | split: '<p><input type="hidden" toc="end" /></p>' | first | split: '<p><input type="hidden" toc="start" /></p>' | last %}
17 {% assign link_prefix = 'href="' | append: site.baseurl | append: entry.url | append: "#" %}
18 {{toc | replace: 'href="#', link_prefix }}
19 {% endif %}
20 {% include navigation.html context=entry.url %}
21 </li>
22 {% endif %}
23 {% endfor %}
24 {% if include.context == "/" %}
25 </ul>
26 </li>
27 {% endif %}
28 </ul>
29 {% endcapture %}{{ html | strip_newlines | replace:' ','' | replace:' ','' | replace:' ',' ' | remove: '<ul class="nav-tree"></ul>'}}