cerrado @ 2eea4b27109e6f958a31890844e2bb69fbc21a48

 1{% code
 2type Selection int
 3const (
 4    Git Selection = iota
 5    List
 6    About
 7    Config
 8    Login
 9)
10%}
11
12{% code
13type GitSelection int
14const (
15    Readme GitSelection = iota
16    Log
17    Summary
18    Refs
19    Tree
20)
21%}
22
23{% func insertIfEqual(s, d any) %}{% if s == d %} selected{% endif %}{% endfunc %}
24
25{% func Navbar (s Selection) %}
26        <nav class="container navbar navbar-expand">
27          <div class="navbar-nav">
28            <a class="nav-link{%= insertIfEqual(s, Git) %}" href="/">git</a>
29          </div>
30          <div class="navbar-nav ms-auto">
31            <a class="nav-link{%= insertIfEqual(s, Login) %}" href="/login">login</a>
32{% comment %}
33Add this back once needed
34            <a class="nav-link{%= insertIfEqual(s, List) %}" href="/list/">list</a>
35{% endcomment %}
36{% comment %}
37Add this back if needed
38            <a class="nav-link{%= insertIfEqual(s, About) %}" href="/about/">about</a>
39{% endcomment %}
40          </div>
41        </nav>
42{% endfunc %}
43
44{% func GitItemNav (name, ref string, s GitSelection) %}
45<div class="row">
46    <h3 id="name">{%s name %} {% if ref != "" && (s == Log || s == Tree)  %}@ {%s ref %}{% endif %}</h3>
47</div>
48<div class="row">
49  <ul class="nav">
50    <li class="nav-item">
51      <a class="nav-link{%= insertIfEqual(s, Readme) %}" aria-current="page" href="/{%s name %}/about/">about</a>
52    </li>
53    <li class="nav-item">
54      <a class="nav-link{%= insertIfEqual(s, Summary) %}" aria-current="page" href="/{%s name %}/">summary</a>
55    </li>
56    <li class="nav-item">
57      <a class="nav-link{%= insertIfEqual(s, Refs) %}" aria-current="page" href="/{%s name %}/refs">refs</a>
58    </li>
59    <li class="nav-item">
60      <a class="nav-link{%= insertIfEqual(s, Log) %}" aria-current="page" href="/{%s name %}/log/{%s ref %}/">log</a>
61    </li>
62    <li class="nav-item">
63      <a class="nav-link{%= insertIfEqual(s, Tree) %}" aria-current="page" href="/{%s name %}/tree/{%s ref %}/">tree</a>
64    </li>
65  </ul>
66</div>
67{% endfunc %}