1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-10-30 03:36:16 +00:00
mycorrhiza/tree/view.qtpl
Timur Ismagilov ac4c4d665c Tree: Drop the sibling sidebar
Because of that, I could reimplement the rest of the package tree more straight-forward. Also deleted the package iteration because it is no longer used anywhere.
2022-08-06 13:45:10 +05:00

33 lines
955 B
Plaintext

{% import "sort" %}
{% import "path" %}
{% import "github.com/bouncepaw/mycorrhiza/util" %}
Subhyphae links are recursive. It may end up looking like that if drawn with
pseudographics:
╔══════════════╗
║Foo ║ The presented hyphae are ./foo and ./foo/bar
║╔════════════╗║
║║Bar ║║
║╚════════════╝║
╚══════════════╝
{% func childHTML(c *child) %}
{% code
sort.Slice(c.children, func(i, j int) bool {
return c.children[i].name < c.children[j].name
})
%}
<li class="subhyphae__entry">
<a class="subhyphae__link {% if !c.exists %}wikilink_new{% endif %}" href="/hypha/{%s c.name %}">
{%s util.BeautifulName(path.Base(c.name)) %}
</a>
{% if len(c.children) > 0 %}
<ul>
{% for _, child := range c.children %}
{%s= childHTML(&child) %}
{% endfor %}
</ul>
{% endif %}
</li>
{% endfunc %}