-
Notifications
You must be signed in to change notification settings - Fork 61
/
relations.html
73 lines (67 loc) · 2.91 KB
/
relations.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
{# emit a * for every slash so they can be counted #}
{%- macro countslashes(str) %}
{%- set slashcount = 0 %}
{%- for char in str %}
{%- if char == '/' -%}
*
{%- endif %}
{%- endfor -%}
{%- endmacro %}
{%- set slashcount = countslashes(pagename)|length %}
{%- macro examplename(str) %}
{%- set slashcount = 0 %}
{%- for char in str %}
{%- if char == '/' -%}
{%- set slashcount = slashcount + 1 %}
{%- else %}
{%- if slashcount > 2 and slashcount < 4 %}{{ char }}{%- endif %}
{%- endif %}
{%- endfor -%}
{%- endmacro %}
{%- set archivename = examplename(pagename)%}
{%- if prev %}
{%- if slashcount == 4 %}
<li>
<a href="{{ prev.link|e }}" title="{{ _('Previous example: ') + prev.title|striptags }}">
{%- if theme_bootstrap_version == "2" -%}<span class="icon-chevron-left visible-tablet"></span>{%- endif -%}
{%- if theme_bootstrap_version == "3" -%}<span class="glyphicon glyphicon-chevron-left visible-sm"></span>{%- endif -%}
<span class="hidden-sm hidden-tablet">{{ "«"|safe }} Previous example</span>
</a>
</li>
{%- else %}
<li>
<a href="{{ prev.link|e }}" title="{{ _('Previous topic: ') + prev.title|striptags }}">
{%- if theme_bootstrap_version == "2" -%}<span class="icon-chevron-left visible-tablet"></span>{%- endif -%}
{%- if theme_bootstrap_version == "3" -%}<span class="glyphicon glyphicon-chevron-left visible-sm"></span>{%- endif -%}
<span class="hidden-sm hidden-tablet">{{ "«"|safe }} {{ prev.title|striptags|truncate(length=16, killwords=True) }}</span>
</a>
</li>
{%- endif %}
{%- endif %}
{%- if next %}
{%- if slashcount == 4 %}
<li>
<a href="{{ next.link|e }}" title="{{ _('Next example: ') + next.title|striptags }}">
{%- if theme_bootstrap_version == "2" -%}<span class="icon-chevron-right visible-tablet"></span>{%- endif -%}
{%- if theme_bootstrap_version == "3" -%}<span class="glyphicon glyphicon-chevron-right visible-sm"></span>{%- endif -%}
<span class="hidden-sm hidden-tablet">Next example {{ "»"|safe }}</span>
</a>
</li>
{%- else %}
<li>
<a href="{{ next.link|e }}" title="{{ _('Next topic: ') + next.title|striptags }}">
{%- if theme_bootstrap_version == "2" -%}<span class="icon-chevron-right visible-tablet"></span>{%- endif -%}
{%- if theme_bootstrap_version == "3" -%}<span class="glyphicon glyphicon-chevron-right visible-sm"></span>{%- endif -%}
<span class="hidden-sm hidden-tablet">{{ next.title|striptags|truncate(length=16, killwords=True) }} {{ "»"|safe }}</span>
</a>
{%- endif %}
{%- endif %}
{%- if slashcount == 4 %}
<li class="dropdown">
<a href="{{ meta.get("name") ~ ".zip" }}">
<span class="glyphicon glyphicon-download-alt"></span> <span class="hidden-sm hidden-tablet"> {{ _('Download') }}</span>
</a>
</li>
{%- endif %}
<canvas id="testCanvas" width="8" height="8" hidden>
</canvas>