-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnav.html
More file actions
57 lines (53 loc) · 2.49 KB
/
nav.html
File metadata and controls
57 lines (53 loc) · 2.49 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
<!-- the backlink, title, and categories/chapters bar for ref/tut/lib pages -->
{%- macro nav(sect=None, title=None, root='', tutorial=None, siblings=[]) -%}
{%- set section={'ref':'Reference', 'tut':"Tutorials", 'lib':"Libraries"}[sect] -%}
<nav class="{{sect}}">
<h1><a href="{{root}}../manual.html#{{sect}}">PlotDevice <span>{{section}}</span></a></h1>
{%- if title and title=='plotdevice' -%}
<h3 class="tt">{{title}}</h3>
{%- elif title and sect!='ref' -%}
<h3>{{title.replace('Bezier','Bézier')}}</h3>
{%- endif -%}
{%- if sect=='ref' -%}
{{categories(siblings, title)}}
{{chapters(siblings, ref=title)}}
{%- endif -%}
{%- if tutorial -%}
{{chapters(siblings, tut=tutorial)}}
{%- endif -%}
</nav>
{%- endmacro %}
<!-- the prev/next stepper at the foot of tutorial pages on mobile -->
{%- macro footer(tutorial=None, siblings=[]) -%}
{%- if tutorial -%}
<footer>
{{chapters(siblings, tut=tutorial)}}
</footer>
{%- endif -%}
{%- endmacro %}
<!-- the prev/next stepper in the tuts (as well as refs on mobile) -->
{%- macro chapters(book, ref=None, tut=None) -%}
{%- set title=tut if tut else ref -%}
{%- set chapter="%i"%(book.index(title)+1) if tut in book else ref.replace('+',' & ') if ref else None-%}
{%- set next=book[book.index(title)+1].replace('é','e') if title in book and title!=book[-1] else None -%}
{%- set nextname=next.replace('+',' & ').replace('_',' ').replace('Bezier','Bézier') if next else None -%}
{%- set prev=book[book.index(title)-1].replace('é','e') if title in book and title!=book[0] else None -%}
{%- set prevname=prev.replace('+',' & ').replace('_',' ').replace('Bezier','Bézier') if prev else None -%}
<ul class="chapter">
{% if prev %} <li class="prev"><a href="{{prev}}.html">❮ {{prevname}}</a><a class="stepper" href="{{prev}}.html">❮</a></li> {%- endif -%}
{% if chapter %}<li class="current">{{chapter}}</li> {%- endif -%}
{% if next %} <li class="next"><a href="{{next}}.html">{{nextname}} ❯</a><a class="stepper" href="{{next}}.html">❯</a></li> {%- endif -%}
</ul>
{%- endmacro %}
<!-- the section-names navbar at the top of ref pages -->
{%- macro categories(cats, title) -%}
<ul class="siblings">
{% for sect in cats %}
{%- if sect==title -%}
<li class="active"><h3 style="margin:0;">{{sect.replace('+',' & ').replace('Misc','Misc.').replace('ography','e')}}</h3></li>
{%- else -%}
<li><a href="{{sect}}.html">{{sect.replace('+',' & ').replace('Misc','Misc.').replace('ography','e')}}</a></li>
{%- endif -%}
{%- endfor -%}
</ul>
{%- endmacro %}