-
Notifications
You must be signed in to change notification settings - Fork 113
Expand file tree
/
Copy pathindex.njk
More file actions
67 lines (59 loc) · 1.75 KB
/
index.njk
File metadata and controls
67 lines (59 loc) · 1.75 KB
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
{%- extends 'layout.njk' -%}
{%- macro formatTag(tagName, tagType) -%}
{%- if tagType == 'inlineTag' -%}
{@{{ tagName }}}
{%- else -%}
@{{ tagName }}
{%- endif -%}
{%- endmacro -%}
{%- macro generateSection(tocSection) -%}
<ul>
{%- for item in collections[tocSection.generated] | sortTags -%}
{%- set tagName = item.data.tag -%}
<li>
<a href="{{ item.filePathStem }}">{{ formatTag(tagName, tocSection.generated) }}</a>
</li>
{%- endfor -%}
</ul>
{%- endmacro -%}
{%- macro renderSection(tocSection) -%}
<h2 id="{{ tocSection.section | slugify }}">{{ tocSection.section }}</h2>
{%- if tocSection.generated -%}
{{ generateSection(tocSection) }}
{%- else -%}
<ul>
{%- for item in tocSection.contents -%}
<li><a href="{{ item.path | default('') }}">{{ item.title | default('') }}</a></li>
{%- endfor -%}
</ul>
{%- endif -%}
{%- endmacro -%}
{%- block content -%}
{% if title -%}
<h1>{{ title }}</h1>
{%- endif %}
{%- block synonyms -%}
{%- if synonyms | length -%}
<h2 id="synonyms">Synonyms</h2>
<ul>
{% for synonym in synonyms -%}
<li><code>{{ synonym }}</code></li>
{%- endfor %}
</ul>
{%- endif -%}
{%- endblock -%}
{{ content | safe }}
{%- if related | length -%}
{%- set relatedLinks = related | relatedList(collections) -%}
<h2 id="related-links">Related links</h2>
<ul>
{%- for relatedLink in relatedLinks -%}
<li><a href="{{ relatedLink.path }}">{{ relatedLink.title }}</a></li>
{%- endfor -%}
</ul>
{%- endif -%}
<!-- Additional content, GitHub ribbon -->
<p>
<a href="https://github.com/jsdoc/jsdoc" class="github-ribbon">Fork me on<br>GitHub</a>
</p>
{% endblock %}