1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-12-12 05:20:26 +00:00
mycorrhiza/tree/view.qtpl

53 lines
1.5 KiB
Plaintext
Raw Normal View History

{% 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">
2021-10-01 09:18:11 +00:00
<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 %}
{% func siblingHTML(s *sibling) %}
2021-07-12 15:23:25 +00:00
<li class="sibling-hyphae__entry">
2021-10-01 08:57:00 +00:00
<a class="sibling-hyphae__link {% if !s.exists %}wikilink_new{% endif %}" href="/hypha/{%s s.name %}">
{%s util.BeautifulName(path.Base(s.name)) %}
2021-07-12 15:23:25 +00:00
<span class="sibling-hyphae__count">
{% if s.directSubhyphaeCount > 0 %}
2021-07-12 15:23:25 +00:00
<span class="sibling-hyphae__direct-count">
{%d s.directSubhyphaeCount %}
</span>
{% endif %}
{% if s.indirectSubhyphaeCount > 0 %}
2021-07-12 15:23:25 +00:00
<span class="sibling-hyphae__indirect-count">
({%d s.indirectSubhyphaeCount %})
</span>
{% endif %}
</span>
</a>
</li>
{% endfunc %}