cerrado @ f1643ffcbd543cacfe9ab5e46eafdd0c39cd47fd

 1{% code
 2type Selection int
 3const (
 4    Git Selection = iota
 5    List
 6    About
 7    Config
 8)
 9%}
10
11{% code
12type GitSelection int
13const (
14    Readme GitSelection = iota
15    Log
16    Summary
17    Refs
18    Tree
19)
20%}
21
22{% func insertIfEqual(s, d any) %}{% if s == d %} selected{% endif %}{% endfunc %}
23
24{% func Navbar (s Selection) %}
25        <nav class="container navbar navbar-expand">
26          <div class="navbar-nav">
27            <a class="nav-link{%= insertIfEqual(s, Git) %}" href="/">git</a>
28            <a class="nav-link{%= insertIfEqual(s, List) %}" href="/list">list</a>
29            <a class="nav-link{%= insertIfEqual(s, About) %}" href="/about">about</a>
30            <a class="nav-link{%= insertIfEqual(s, Config) %}" href="/config">config</a>
31          </div>
32        </nav>
33{% endfunc %}
34
35{% func GitItemNav (name string, s GitSelection) %}
36  <ul class="nav">
37    <li class="nav-item">
38      <a class="nav-link{%= insertIfEqual(s, Readme) %}" aria-current="page" href="/{%s name %}/about">about</a>
39    </li>
40    <li class="nav-item">
41      <a class="nav-link{%= insertIfEqual(s, Log) %}" aria-current="page" href="/{%s name %}/log">log</a>
42    </li>
43    <li class="nav-item">
44      <a class="nav-link{%= insertIfEqual(s, Summary) %}" aria-current="page" href="/{%s name %}/summary">summary</a>
45    </li>
46    <li class="nav-item">
47      <a class="nav-link{%= insertIfEqual(s, Refs) %}" aria-current="page" href="/{%s name %}/refs">refs</a>
48    </li>
49    <li class="nav-item">
50      <a class="nav-link{%= insertIfEqual(s, Tree) %}" aria-current="page" href="/{%s name %}/tree">tree</a>
51    </li>
52  </ul>
53{% endfunc %}