{% import "fmt" %} {% import "path/filepath" %} {% import "github.com/bouncepaw/mycorrhiza/cfg" %} {% import "github.com/bouncepaw/mycorrhiza/hyphae" %} {% import "github.com/bouncepaw/mycorrhiza/user" %} {% import "github.com/bouncepaw/mycorrhiza/util" %} {% import "github.com/bouncepaw/mycorrhiza/l18n" %} {% func BaseHTML(title, body string, lc *l18n.Localizer, u *user.User, headElements ...string) %} {%s title %} {% for _, el := range headElements %}{%s= el %}{% endfor %}
{%s= body %} {%= CommonScripts() %} {% endfunc %} {% func TitleSearchHTML(query string, generator func(string) <-chan string, lc *l18n.Localizer) %}

{%s lc.Get("ui.search_results_query", &l18n.Replacements{"query": query})%}

{%s lc.Get("ui.search_results_desc")%}

{% endfunc %} It outputs a poorly formatted JSON, but it works and is valid. {% func TitleSearchJSON(query string, generator func(string) <-chan string) %} {% code // Lol counter := 0 %} { "source_query": "{%s query %}", "results": [ {% for hyphaName := range generator(query) %} {% if counter > 0 %}, {% endif %}{ "canonical_name": "{%s hyphaName %}", "beautiful_name": "{%s util.BeautifulName(hyphaName) %}", "url": "{%s cfg.URL + "/hypha/" + hyphaName %}" }{% code counter++ %} {% endfor %} ] } {% endfunc %} {% func BacklinksHTML(hyphaName string, generator func(string) <-chan string, lc *l18n.Localizer) %}

{%s= lc.Get( "ui.backlinks_heading", &l18n.Replacements{ "hypha_link": fmt.Sprintf( `%s`, hyphaName, util.BeautifulName(hyphaName), ), }, )%}

{%s lc.Get("ui.backlinks_desc")%}

{% endfunc %} {% func HelpHTML(content, lang string, lc *l18n.Localizer) %}
{%s= content %}
{%s= helpTopicsHTML(lang, lc) %}
{% endfunc %} {% func HelpEmptyErrorHTML(lc *l18n.Localizer) %}

{%s lc.Get("help.empty_error_title") %}

{%s lc.Get("help.empty_error_line_1") %}

{%s lc.Get("help.empty_error_line_2a") %} {%s lc.Get("help.empty_error_link") %} {%s lc.Get("help.empty_error_line_2b") %}

{% endfunc %} {% func helpTopicBadgeHTML(lang, topic string) %} ? {% endfunc %} {% func HyphaListHTML(lc *l18n.Localizer) %}

{%s lc.Get("ui.list_heading") %}

{%s lc.GetPlural("ui.list_desc", hyphae.Count()) %}

{% endfunc %} {% func CommonScripts() %} {% for _, scriptPath := range cfg.CommonScripts %} {% endfor %} {% endfunc %}