Reimplement empty hypha notice with go templates

This commit is contained in:
Timur Ismagilov 2022-04-24 14:11:53 +03:00
parent 79519f0a7d
commit 49b94074d1
10 changed files with 376 additions and 652 deletions

View File

@ -2,7 +2,6 @@ package hypview
import ( import (
"embed" "embed"
"fmt"
"github.com/bouncepaw/mycorrhiza/cfg" "github.com/bouncepaw/mycorrhiza/cfg"
"github.com/bouncepaw/mycorrhiza/viewutil" "github.com/bouncepaw/mycorrhiza/viewutil"
"log" "log"
@ -12,15 +11,49 @@ import (
var ( var (
//go:embed *.html //go:embed *.html
fs embed.FS fs embed.FS
ruTranslation = `` ruTranslation = `
chainNaviTitle viewutil.Chain {{define "empty heading"}}Эта гифа не существует{{end}}
{{define "empty no rights"}}У вас нет прав для создания новых гиф. Вы можете:{{end}}
{{define "empty log in"}}Войти в свою учётную запись, если она у вас есть{{end}}
{{define "empty register"}}Создать новую учётную запись{{end}}
{{define "write a text"}}Написать текст{{end}}
{{define "write a text tip"}}Напишите заметку, дневник, статью, рассказ или иной текст с помощью <a href="/help/en/mycomarkup" class="shy-link">микоразметки</a>. Сохраняется полная история правок документа.{{end}}
{{define "write a text writing conventions"}}Не забывайте следовать правилам оформления этой вики, если они имеются.{{end}}
{{define "write a text btn"}}Создать{{end}}
{{define "upload a media"}}Загрузить медиа{{end}}
{{define "upload a media tip"}}Загрузите изображение, видео или аудио. Распространённые форматы можно просматривать из браузера, остальные просто скачать. Позже вы можете дописать пояснение к этому медиа.{{end}}
{{define "upload a media btn"}}Загрузить{{end}}
`
chainNaviTitle viewutil.Chain
chainEmptyHypha viewutil.Chain
) )
func Init() { func Init() {
chainNaviTitle = viewutil. chainNaviTitle = viewutil.
En(viewutil.CopyEnWith(fs, "view_navititle.html")). En(viewutil.CopyEnWith(fs, "view_navititle.html")).
Ru(template.Must(viewutil.CopyRuWith(fs, "view_navititle.html").Parse(ruTranslation))) Ru(viewutil.CopyRuWith(fs, "view_navititle.html")) // no text inside
chainEmptyHypha = viewutil.
En(viewutil.CopyEnWith(fs, "view_empty_hypha.html")).
Ru(template.Must(viewutil.CopyRuWith(fs, "view_empty_hypha.html").Parse(ruTranslation)))
}
type emptyHyphaData struct {
HyphaName string
AllowRegistration bool
UseAuth bool
}
func EmptyHypha(meta viewutil.Meta, hyphaName string) string {
var buf strings.Builder
if err := chainEmptyHypha.Get(meta).ExecuteTemplate(&buf, "empty hypha card", emptyHyphaData{
HyphaName: hyphaName,
AllowRegistration: cfg.AllowRegistration,
UseAuth: cfg.UseAuth,
}); err != nil {
log.Println(err)
}
return buf.String()
} }
type naviTitleData struct { type naviTitleData struct {
@ -57,6 +90,5 @@ func naviTitleify(hyphaName string) ([]string, []string) {
partsWithParents = append(partsWithParents, prevAcc) partsWithParents = append(partsWithParents, prevAcc)
} }
fmt.Printf("%q — %q\n", parts, partsWithParents)
return parts, partsWithParents return parts, partsWithParents
} }

View File

@ -0,0 +1,32 @@
{{define "empty hypha card"}}
<section class="non-existent-hypha">
<h2 class="non-existent-hypha__title">{{block "empty heading" .}}This hypha does not exist{{end}}</h2>
{{if and .UseAuth (eq .Meta.U.Group "anon")}}
<p>{{block "empty no rights" .}}You are not authorized to create new hyphae. Here is what you can do:{{end}}</p>
<ul>
<li><a href="/login">{{block "empty log in" .}}Log in to your account, if you have one{{end}}</a></li>
{{if .AllowRegistration}}<li><a href="/register">{{block "empty register" .}}Register a new account{{end}}</a></li>{{end}}
</ul>
{{else}}
<div class="non-existent-hypha__ways">
<section class="non-existent-hypha__way">
<h3 class="non-existent-hypha__subtitle">📝 {{block "write a text" .}}Write a text{{end}}</h3>
<p>{{block "write a text tip" .}}Write a note, a diary, an article, a story or anything textual using <a href="/help/en/mycomarkup" class="shy-link">Mycomarkup</a>. Full history of edits to the document will be saved.{{end}}</p>
<p>{{block "write a text writing conventions" .}}Make sure to follow this wiki's writing conventions if there are any.{{end}}</p>
<a class="btn btn_accent stick-to-bottom" href="/edit/{{.HyphaName}}">{{block "write a text btn" .}}Create{{end}}</a>
</section>
<section class="non-existent-hypha__way">
<h3 class="non-existent-hypha__subtitle">🖼 {{block "upload a media" .}}Upload a media{{end}}</h3>
<p>{{block "upload a media tip" .}}Upload a picture, a video or an audio. Most common formats can be accessed from the browser, others can be only downloaded afterwards. You can write a description for the media later.{{end}}</p>
<form action="/upload-binary/{{.HyphaName}}"
method="post" enctype="multipart/form-data"
class="upload-binary">
<input type="file" id="upload-binary__input" name="binary">
<button type="submit" class="btn stick-to-bottom" value="Upload">{{block "upload a media btn" .}}Upload{{end}}</button>
</form>
</section>
</div>
{{end}}
</section>
{{end}}

View File

@ -84,18 +84,6 @@
"reindex_no_rights": "You must be an admin to reindex hyphae.", "reindex_no_rights": "You must be an admin to reindex hyphae.",
"header_no_rights": "You must be a moderator to update header links.", "header_no_rights": "You must be a moderator to update header links.",
"notexist_heading": "This hypha does not exist",
"notexist_norights": "You are not authorized to create new hyphae. Here is what you can do:",
"notexist_login": "Log in to your account, if you have one",
"notexist_register": "Register a new account",
"notexist_write": "Write a text",
"notexist_write_tip1": "Write a note, a diary, an article, a story or anything textual using {{.myco}}. Full history of edits to the document will be saved.",
"notexist_write_myco": "Mycomarkup",
"notexist_write_tip2": "Make sure to follow this wiki's writing conventions if there are any.",
"notexist_write_button": "Create",
"notexist_media": "Upload a media",
"notexist_media_tip1": "Upload a picture, a video or an audio. Most common formats can be accessed from the browser, others can be only downloaded afterwards. You can write a description for the media later.",
"media_download": "Download media", "media_download": "Download media",
"media_novideo": "Your browser does not support video.", "media_novideo": "Your browser does not support video.",
"media_novideo_link": "Download video", "media_novideo_link": "Download video",

View File

@ -90,18 +90,6 @@
"reindex_no_rights": "Вы должны быть администратором, чтобы переиндексировать гифы.", "reindex_no_rights": "Вы должны быть администратором, чтобы переиндексировать гифы.",
"header_no_rights": "Вы должны быть модератором, чтобы обновить ссылки в заголовке.", "header_no_rights": "Вы должны быть модератором, чтобы обновить ссылки в заголовке.",
"notexist_heading": "Эта гифа не существует",
"notexist_norights": "У вас нет прав для создания новых гиф. Вы можете:",
"notexist_login": "Войти в свою учётную запись, если она у вас есть",
"notexist_register": "Создать новую учётную запись",
"notexist_write": "Написать текст",
"notexist_write_tip1": "Напишите заметку, дневник, статью, рассказ или иной текст с помощью {{.myco}}. Сохраняется полная история правок документа.",
"notexist_write_myco": "микоразметки",
"notexist_write_tip2": "Не забывайте следовать правилам оформления этой вики, если они имеются.",
"notexist_write_button": "Создать",
"notexist_media": "Загрузить медиа",
"notexist_media_tip1": "Загрузите изображение, видео или аудио. Распространённые форматы можно просматривать из браузера, остальные просто скачать. Позже вы можете дописать пояснение к этому медиа.",
"media_download": "Скачать медиа", "media_download": "Скачать медиа",
"media_novideo": "Ваш браузер не поддерживает видео.", "media_novideo": "Ваш браузер не поддерживает видео.",
"media_novideo_link": "Скачать видео", "media_novideo_link": "Скачать видео",

View File

@ -1,51 +1,11 @@
{% import "path/filepath" %} {% import "path/filepath" %}
{% import "github.com/bouncepaw/mycorrhiza/cfg" %}
{% import "github.com/bouncepaw/mycorrhiza/hyphae" %} {% import "github.com/bouncepaw/mycorrhiza/hyphae" %}
{% import "github.com/bouncepaw/mycorrhiza/l18n" %} {% import "github.com/bouncepaw/mycorrhiza/l18n" %}
{% import "github.com/bouncepaw/mycorrhiza/user" %}
{% import "github.com/bouncepaw/mycorrhiza/util" %} {% import "github.com/bouncepaw/mycorrhiza/util" %}
{% func beautifulLink(hyphaName string) %}<a href="/hypha/{%s= hyphaName %}">{%s util.BeautifulName(hyphaName) %}</a>{% endfunc %} {% func beautifulLink(hyphaName string) %}<a href="/hypha/{%s= hyphaName %}">{%s util.BeautifulName(hyphaName) %}</a>{% endfunc %}
{% func mycoLink(lc *l18n.Localizer) %}<a href="/help/en/mycomarkup" class="shy-link">{%s lc.Get("ui.notexist_write_myco") %}</a>{% endfunc %}
{% func nonExistentHyphaNotice(h hyphae.Hypha, u *user.User, lc *l18n.Localizer) %}
<section class="non-existent-hypha">
<h2 class="non-existent-hypha__title">{%s lc.Get("ui.notexist_heading") %}</h2>
{% if cfg.UseAuth && u.Group == "anon" %}
<p>{%s lc.Get("ui.notexist_norights") %}</p>
<ul>
<li><a href="/login">{%s lc.Get("ui.notexist_login") %}</a></li>
{% if cfg.AllowRegistration %}<li><a href="/register">{%s lc.Get("ui.notexist_register") %}</a></li>{% endif %}
</ul>
{% else %}
<div class="non-existent-hypha__ways">
<section class="non-existent-hypha__way">
<h3 class="non-existent-hypha__subtitle">📝 {%s lc.Get("ui.notexist_write") %}</h3>
<p>{%s= lc.Get("ui.notexist_write_tip1", &l18n.Replacements{"myco": mycoLink(lc)}) %}</p>
<p>{%s lc.Get("ui.notexist_write_tip2") %}</p>
<a class="btn btn_accent stick-to-bottom" href="/edit/{%s h.CanonicalName() %}">{%s lc.Get("ui.notexist_write_button") %}</a>
</section>
<section class="non-existent-hypha__way">
<h3 class="non-existent-hypha__subtitle">🖼 {%s lc.Get("ui.notexist_media") %}</h3>
<p>{%s lc.Get("ui.notexist_media_tip1") %}</p>
<form action="/upload-binary/{%s h.CanonicalName() %}"
method="post" enctype="multipart/form-data"
class="upload-binary">
<label for="upload-binary__input"></label>
<input type="file" id="upload-binary__input" name="binary">
<button type="submit" class="btn stick-to-bottom" value="Upload">{%s lc.Get("ui.media_upload")%}</button>
</form>
</section>
</div>
{% endif %}
</section>
{% endfunc %}
{% func MediaRaw(h *hyphae.MediaHypha) %}{%= Media(h, l18n.New("en", "en")) %}{% endfunc %} {% func MediaRaw(h *hyphae.MediaHypha) %}{%= Media(h, l18n.New("en", "en")) %}{% endfunc %}
{% func Media(h *hyphae.MediaHypha, lc *l18n.Localizer) %} {% func Media(h *hyphae.MediaHypha, lc *l18n.Localizer) %}

View File

@ -8,409 +8,227 @@ package views
import "path/filepath" import "path/filepath"
//line views/hypha.qtpl:3 //line views/hypha.qtpl:3
import "github.com/bouncepaw/mycorrhiza/cfg"
//line views/hypha.qtpl:4
import "github.com/bouncepaw/mycorrhiza/hyphae" import "github.com/bouncepaw/mycorrhiza/hyphae"
//line views/hypha.qtpl:5 //line views/hypha.qtpl:4
import "github.com/bouncepaw/mycorrhiza/l18n" import "github.com/bouncepaw/mycorrhiza/l18n"
//line views/hypha.qtpl:6 //line views/hypha.qtpl:5
import "github.com/bouncepaw/mycorrhiza/user"
//line views/hypha.qtpl:7
import "github.com/bouncepaw/mycorrhiza/util" import "github.com/bouncepaw/mycorrhiza/util"
//line views/hypha.qtpl:9 //line views/hypha.qtpl:7
import ( import (
qtio422016 "io" qtio422016 "io"
qt422016 "github.com/valyala/quicktemplate" qt422016 "github.com/valyala/quicktemplate"
) )
//line views/hypha.qtpl:9 //line views/hypha.qtpl:7
var ( var (
_ = qtio422016.Copy _ = qtio422016.Copy
_ = qt422016.AcquireByteBuffer _ = qt422016.AcquireByteBuffer
) )
//line views/hypha.qtpl:9 //line views/hypha.qtpl:7
func streambeautifulLink(qw422016 *qt422016.Writer, hyphaName string) { func streambeautifulLink(qw422016 *qt422016.Writer, hyphaName string) {
//line views/hypha.qtpl:9 //line views/hypha.qtpl:7
qw422016.N().S(`<a href="/hypha/`) qw422016.N().S(`<a href="/hypha/`)
//line views/hypha.qtpl:9 //line views/hypha.qtpl:7
qw422016.N().S(hyphaName) qw422016.N().S(hyphaName)
//line views/hypha.qtpl:9 //line views/hypha.qtpl:7
qw422016.N().S(`">`) qw422016.N().S(`">`)
//line views/hypha.qtpl:9 //line views/hypha.qtpl:7
qw422016.E().S(util.BeautifulName(hyphaName)) qw422016.E().S(util.BeautifulName(hyphaName))
//line views/hypha.qtpl:9 //line views/hypha.qtpl:7
qw422016.N().S(`</a>`) qw422016.N().S(`</a>`)
//line views/hypha.qtpl:9 //line views/hypha.qtpl:7
} }
//line views/hypha.qtpl:9 //line views/hypha.qtpl:7
func writebeautifulLink(qq422016 qtio422016.Writer, hyphaName string) { func writebeautifulLink(qq422016 qtio422016.Writer, hyphaName string) {
//line views/hypha.qtpl:9 //line views/hypha.qtpl:7
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line views/hypha.qtpl:9 //line views/hypha.qtpl:7
streambeautifulLink(qw422016, hyphaName) streambeautifulLink(qw422016, hyphaName)
//line views/hypha.qtpl:9 //line views/hypha.qtpl:7
qt422016.ReleaseWriter(qw422016) qt422016.ReleaseWriter(qw422016)
//line views/hypha.qtpl:9 //line views/hypha.qtpl:7
} }
//line views/hypha.qtpl:9 //line views/hypha.qtpl:7
func beautifulLink(hyphaName string) string { func beautifulLink(hyphaName string) string {
//line views/hypha.qtpl:9 //line views/hypha.qtpl:7
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line views/hypha.qtpl:9 //line views/hypha.qtpl:7
writebeautifulLink(qb422016, hyphaName) writebeautifulLink(qb422016, hyphaName)
//line views/hypha.qtpl:9 //line views/hypha.qtpl:7
qs422016 := string(qb422016.B) qs422016 := string(qb422016.B)
//line views/hypha.qtpl:9 //line views/hypha.qtpl:7
qt422016.ReleaseByteBuffer(qb422016) qt422016.ReleaseByteBuffer(qb422016)
//line views/hypha.qtpl:7
return qs422016
//line views/hypha.qtpl:7
}
//line views/hypha.qtpl:9 //line views/hypha.qtpl:9
return qs422016
//line views/hypha.qtpl:9
}
//line views/hypha.qtpl:11
func streammycoLink(qw422016 *qt422016.Writer, lc *l18n.Localizer) {
//line views/hypha.qtpl:11
qw422016.N().S(`<a href="/help/en/mycomarkup" class="shy-link">`)
//line views/hypha.qtpl:11
qw422016.E().S(lc.Get("ui.notexist_write_myco"))
//line views/hypha.qtpl:11
qw422016.N().S(`</a>`)
//line views/hypha.qtpl:11
}
//line views/hypha.qtpl:11
func writemycoLink(qq422016 qtio422016.Writer, lc *l18n.Localizer) {
//line views/hypha.qtpl:11
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/hypha.qtpl:11
streammycoLink(qw422016, lc)
//line views/hypha.qtpl:11
qt422016.ReleaseWriter(qw422016)
//line views/hypha.qtpl:11
}
//line views/hypha.qtpl:11
func mycoLink(lc *l18n.Localizer) string {
//line views/hypha.qtpl:11
qb422016 := qt422016.AcquireByteBuffer()
//line views/hypha.qtpl:11
writemycoLink(qb422016, lc)
//line views/hypha.qtpl:11
qs422016 := string(qb422016.B)
//line views/hypha.qtpl:11
qt422016.ReleaseByteBuffer(qb422016)
//line views/hypha.qtpl:11
return qs422016
//line views/hypha.qtpl:11
}
//line views/hypha.qtpl:13
func streamnonExistentHyphaNotice(qw422016 *qt422016.Writer, h hyphae.Hypha, u *user.User, lc *l18n.Localizer) {
//line views/hypha.qtpl:13
qw422016.N().S(`
<section class="non-existent-hypha">
<h2 class="non-existent-hypha__title">`)
//line views/hypha.qtpl:15
qw422016.E().S(lc.Get("ui.notexist_heading"))
//line views/hypha.qtpl:15
qw422016.N().S(`</h2>
`)
//line views/hypha.qtpl:16
if cfg.UseAuth && u.Group == "anon" {
//line views/hypha.qtpl:16
qw422016.N().S(`
<p>`)
//line views/hypha.qtpl:17
qw422016.E().S(lc.Get("ui.notexist_norights"))
//line views/hypha.qtpl:17
qw422016.N().S(`</p>
<ul>
<li><a href="/login">`)
//line views/hypha.qtpl:19
qw422016.E().S(lc.Get("ui.notexist_login"))
//line views/hypha.qtpl:19
qw422016.N().S(`</a></li>
`)
//line views/hypha.qtpl:20
if cfg.AllowRegistration {
//line views/hypha.qtpl:20
qw422016.N().S(`<li><a href="/register">`)
//line views/hypha.qtpl:20
qw422016.E().S(lc.Get("ui.notexist_register"))
//line views/hypha.qtpl:20
qw422016.N().S(`</a></li>`)
//line views/hypha.qtpl:20
}
//line views/hypha.qtpl:20
qw422016.N().S(`
</ul>
`)
//line views/hypha.qtpl:22
} else {
//line views/hypha.qtpl:22
qw422016.N().S(`
<div class="non-existent-hypha__ways">
<section class="non-existent-hypha__way">
<h3 class="non-existent-hypha__subtitle">📝 `)
//line views/hypha.qtpl:26
qw422016.E().S(lc.Get("ui.notexist_write"))
//line views/hypha.qtpl:26
qw422016.N().S(`</h3>
<p>`)
//line views/hypha.qtpl:27
qw422016.N().S(lc.Get("ui.notexist_write_tip1", &l18n.Replacements{"myco": mycoLink(lc)}))
//line views/hypha.qtpl:27
qw422016.N().S(`</p>
<p>`)
//line views/hypha.qtpl:28
qw422016.E().S(lc.Get("ui.notexist_write_tip2"))
//line views/hypha.qtpl:28
qw422016.N().S(`</p>
<a class="btn btn_accent stick-to-bottom" href="/edit/`)
//line views/hypha.qtpl:29
qw422016.E().S(h.CanonicalName())
//line views/hypha.qtpl:29
qw422016.N().S(`">`)
//line views/hypha.qtpl:29
qw422016.E().S(lc.Get("ui.notexist_write_button"))
//line views/hypha.qtpl:29
qw422016.N().S(`</a>
</section>
<section class="non-existent-hypha__way">
<h3 class="non-existent-hypha__subtitle">🖼 `)
//line views/hypha.qtpl:33
qw422016.E().S(lc.Get("ui.notexist_media"))
//line views/hypha.qtpl:33
qw422016.N().S(`</h3>
<p>`)
//line views/hypha.qtpl:34
qw422016.E().S(lc.Get("ui.notexist_media_tip1"))
//line views/hypha.qtpl:34
qw422016.N().S(`</p>
<form action="/upload-binary/`)
//line views/hypha.qtpl:35
qw422016.E().S(h.CanonicalName())
//line views/hypha.qtpl:35
qw422016.N().S(`"
method="post" enctype="multipart/form-data"
class="upload-binary">
<label for="upload-binary__input"></label>
<input type="file" id="upload-binary__input" name="binary">
<button type="submit" class="btn stick-to-bottom" value="Upload">`)
//line views/hypha.qtpl:41
qw422016.E().S(lc.Get("ui.media_upload"))
//line views/hypha.qtpl:41
qw422016.N().S(`</button>
</form>
</section>
</div>
`)
//line views/hypha.qtpl:45
}
//line views/hypha.qtpl:45
qw422016.N().S(`
</section>
`)
//line views/hypha.qtpl:47
}
//line views/hypha.qtpl:47
func writenonExistentHyphaNotice(qq422016 qtio422016.Writer, h hyphae.Hypha, u *user.User, lc *l18n.Localizer) {
//line views/hypha.qtpl:47
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/hypha.qtpl:47
streamnonExistentHyphaNotice(qw422016, h, u, lc)
//line views/hypha.qtpl:47
qt422016.ReleaseWriter(qw422016)
//line views/hypha.qtpl:47
}
//line views/hypha.qtpl:47
func nonExistentHyphaNotice(h hyphae.Hypha, u *user.User, lc *l18n.Localizer) string {
//line views/hypha.qtpl:47
qb422016 := qt422016.AcquireByteBuffer()
//line views/hypha.qtpl:47
writenonExistentHyphaNotice(qb422016, h, u, lc)
//line views/hypha.qtpl:47
qs422016 := string(qb422016.B)
//line views/hypha.qtpl:47
qt422016.ReleaseByteBuffer(qb422016)
//line views/hypha.qtpl:47
return qs422016
//line views/hypha.qtpl:47
}
//line views/hypha.qtpl:49
func StreamMediaRaw(qw422016 *qt422016.Writer, h *hyphae.MediaHypha) { func StreamMediaRaw(qw422016 *qt422016.Writer, h *hyphae.MediaHypha) {
//line views/hypha.qtpl:49 //line views/hypha.qtpl:9
StreamMedia(qw422016, h, l18n.New("en", "en")) StreamMedia(qw422016, h, l18n.New("en", "en"))
//line views/hypha.qtpl:49 //line views/hypha.qtpl:9
} }
//line views/hypha.qtpl:49 //line views/hypha.qtpl:9
func WriteMediaRaw(qq422016 qtio422016.Writer, h *hyphae.MediaHypha) { func WriteMediaRaw(qq422016 qtio422016.Writer, h *hyphae.MediaHypha) {
//line views/hypha.qtpl:49 //line views/hypha.qtpl:9
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line views/hypha.qtpl:49 //line views/hypha.qtpl:9
StreamMediaRaw(qw422016, h) StreamMediaRaw(qw422016, h)
//line views/hypha.qtpl:49 //line views/hypha.qtpl:9
qt422016.ReleaseWriter(qw422016) qt422016.ReleaseWriter(qw422016)
//line views/hypha.qtpl:49 //line views/hypha.qtpl:9
} }
//line views/hypha.qtpl:49 //line views/hypha.qtpl:9
func MediaRaw(h *hyphae.MediaHypha) string { func MediaRaw(h *hyphae.MediaHypha) string {
//line views/hypha.qtpl:49 //line views/hypha.qtpl:9
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line views/hypha.qtpl:49 //line views/hypha.qtpl:9
WriteMediaRaw(qb422016, h) WriteMediaRaw(qb422016, h)
//line views/hypha.qtpl:49 //line views/hypha.qtpl:9
qs422016 := string(qb422016.B) qs422016 := string(qb422016.B)
//line views/hypha.qtpl:49 //line views/hypha.qtpl:9
qt422016.ReleaseByteBuffer(qb422016) qt422016.ReleaseByteBuffer(qb422016)
//line views/hypha.qtpl:49 //line views/hypha.qtpl:9
return qs422016 return qs422016
//line views/hypha.qtpl:49 //line views/hypha.qtpl:9
} }
//line views/hypha.qtpl:51 //line views/hypha.qtpl:11
func StreamMedia(qw422016 *qt422016.Writer, h *hyphae.MediaHypha, lc *l18n.Localizer) { func StreamMedia(qw422016 *qt422016.Writer, h *hyphae.MediaHypha, lc *l18n.Localizer) {
//line views/hypha.qtpl:51 //line views/hypha.qtpl:11
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/hypha.qtpl:52 //line views/hypha.qtpl:12
switch filepath.Ext(h.MediaFilePath()) { switch filepath.Ext(h.MediaFilePath()) {
//line views/hypha.qtpl:54 //line views/hypha.qtpl:14
case ".jpg", ".gif", ".png", ".webp", ".svg", ".ico": case ".jpg", ".gif", ".png", ".webp", ".svg", ".ico":
//line views/hypha.qtpl:54 //line views/hypha.qtpl:14
qw422016.N().S(` qw422016.N().S(`
<div class="binary-container binary-container_with-img"> <div class="binary-container binary-container_with-img">
<a href="/binary/`) <a href="/binary/`)
//line views/hypha.qtpl:56 //line views/hypha.qtpl:16
qw422016.N().S(h.CanonicalName()) qw422016.N().S(h.CanonicalName())
//line views/hypha.qtpl:56 //line views/hypha.qtpl:16
qw422016.N().S(`"><img src="/binary/`) qw422016.N().S(`"><img src="/binary/`)
//line views/hypha.qtpl:56 //line views/hypha.qtpl:16
qw422016.N().S(h.CanonicalName()) qw422016.N().S(h.CanonicalName())
//line views/hypha.qtpl:56 //line views/hypha.qtpl:16
qw422016.N().S(`"/></a> qw422016.N().S(`"/></a>
</div> </div>
`) `)
//line views/hypha.qtpl:59 //line views/hypha.qtpl:19
case ".ogg", ".webm", ".mp4": case ".ogg", ".webm", ".mp4":
//line views/hypha.qtpl:59 //line views/hypha.qtpl:19
qw422016.N().S(` qw422016.N().S(`
<div class="binary-container binary-container_with-video"> <div class="binary-container binary-container_with-video">
<video controls> <video controls>
<source src="/binary/`) <source src="/binary/`)
//line views/hypha.qtpl:62 //line views/hypha.qtpl:22
qw422016.N().S(h.CanonicalName()) qw422016.N().S(h.CanonicalName())
//line views/hypha.qtpl:62 //line views/hypha.qtpl:22
qw422016.N().S(`"/> qw422016.N().S(`"/>
<p>`) <p>`)
//line views/hypha.qtpl:63 //line views/hypha.qtpl:23
qw422016.E().S(lc.Get("ui.media_novideo")) qw422016.E().S(lc.Get("ui.media_novideo"))
//line views/hypha.qtpl:63 //line views/hypha.qtpl:23
qw422016.N().S(` <a href="/binary/`) qw422016.N().S(` <a href="/binary/`)
//line views/hypha.qtpl:63 //line views/hypha.qtpl:23
qw422016.N().S(h.CanonicalName()) qw422016.N().S(h.CanonicalName())
//line views/hypha.qtpl:63 //line views/hypha.qtpl:23
qw422016.N().S(`">`) qw422016.N().S(`">`)
//line views/hypha.qtpl:63 //line views/hypha.qtpl:23
qw422016.E().S(lc.Get("ui.media_novideo_link")) qw422016.E().S(lc.Get("ui.media_novideo_link"))
//line views/hypha.qtpl:63 //line views/hypha.qtpl:23
qw422016.N().S(`</a></p> qw422016.N().S(`</a></p>
</video> </video>
</div> </div>
`) `)
//line views/hypha.qtpl:67 //line views/hypha.qtpl:27
case ".mp3": case ".mp3":
//line views/hypha.qtpl:67 //line views/hypha.qtpl:27
qw422016.N().S(` qw422016.N().S(`
<div class="binary-container binary-container_with-audio"> <div class="binary-container binary-container_with-audio">
<audio controls> <audio controls>
<source src="/binary/`) <source src="/binary/`)
//line views/hypha.qtpl:70 //line views/hypha.qtpl:30
qw422016.N().S(h.CanonicalName()) qw422016.N().S(h.CanonicalName())
//line views/hypha.qtpl:70 //line views/hypha.qtpl:30
qw422016.N().S(`"/> qw422016.N().S(`"/>
<p>`) <p>`)
//line views/hypha.qtpl:71 //line views/hypha.qtpl:31
qw422016.E().S(lc.Get("ui.media_noaudio")) qw422016.E().S(lc.Get("ui.media_noaudio"))
//line views/hypha.qtpl:71 //line views/hypha.qtpl:31
qw422016.N().S(` <a href="/binary/`) qw422016.N().S(` <a href="/binary/`)
//line views/hypha.qtpl:71 //line views/hypha.qtpl:31
qw422016.N().S(h.CanonicalName()) qw422016.N().S(h.CanonicalName())
//line views/hypha.qtpl:71 //line views/hypha.qtpl:31
qw422016.N().S(`">`) qw422016.N().S(`">`)
//line views/hypha.qtpl:71 //line views/hypha.qtpl:31
qw422016.E().S(lc.Get("ui.media_noaudio_link")) qw422016.E().S(lc.Get("ui.media_noaudio_link"))
//line views/hypha.qtpl:71 //line views/hypha.qtpl:31
qw422016.N().S(`</a></p> qw422016.N().S(`</a></p>
</audio> </audio>
</div> </div>
`) `)
//line views/hypha.qtpl:75 //line views/hypha.qtpl:35
default: default:
//line views/hypha.qtpl:75 //line views/hypha.qtpl:35
qw422016.N().S(` qw422016.N().S(`
<div class="binary-container binary-container_with-nothing"> <div class="binary-container binary-container_with-nothing">
<p><a href="/binary/`) <p><a href="/binary/`)
//line views/hypha.qtpl:77 //line views/hypha.qtpl:37
qw422016.N().S(h.CanonicalName()) qw422016.N().S(h.CanonicalName())
//line views/hypha.qtpl:77 //line views/hypha.qtpl:37
qw422016.N().S(`">`) qw422016.N().S(`">`)
//line views/hypha.qtpl:77 //line views/hypha.qtpl:37
qw422016.E().S(lc.Get("ui.media_download")) qw422016.E().S(lc.Get("ui.media_download"))
//line views/hypha.qtpl:77 //line views/hypha.qtpl:37
qw422016.N().S(`</a></p> qw422016.N().S(`</a></p>
</div> </div>
`) `)
//line views/hypha.qtpl:79 //line views/hypha.qtpl:39
} }
//line views/hypha.qtpl:79 //line views/hypha.qtpl:39
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/hypha.qtpl:80 //line views/hypha.qtpl:40
} }
//line views/hypha.qtpl:80 //line views/hypha.qtpl:40
func WriteMedia(qq422016 qtio422016.Writer, h *hyphae.MediaHypha, lc *l18n.Localizer) { func WriteMedia(qq422016 qtio422016.Writer, h *hyphae.MediaHypha, lc *l18n.Localizer) {
//line views/hypha.qtpl:80 //line views/hypha.qtpl:40
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line views/hypha.qtpl:80 //line views/hypha.qtpl:40
StreamMedia(qw422016, h, lc) StreamMedia(qw422016, h, lc)
//line views/hypha.qtpl:80 //line views/hypha.qtpl:40
qt422016.ReleaseWriter(qw422016) qt422016.ReleaseWriter(qw422016)
//line views/hypha.qtpl:80 //line views/hypha.qtpl:40
} }
//line views/hypha.qtpl:80 //line views/hypha.qtpl:40
func Media(h *hyphae.MediaHypha, lc *l18n.Localizer) string { func Media(h *hyphae.MediaHypha, lc *l18n.Localizer) string {
//line views/hypha.qtpl:80 //line views/hypha.qtpl:40
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line views/hypha.qtpl:80 //line views/hypha.qtpl:40
WriteMedia(qb422016, h, lc) WriteMedia(qb422016, h, lc)
//line views/hypha.qtpl:80 //line views/hypha.qtpl:40
qs422016 := string(qb422016.B) qs422016 := string(qb422016.B)
//line views/hypha.qtpl:80 //line views/hypha.qtpl:40
qt422016.ReleaseByteBuffer(qb422016) qt422016.ReleaseByteBuffer(qb422016)
//line views/hypha.qtpl:80 //line views/hypha.qtpl:40
return qs422016 return qs422016
//line views/hypha.qtpl:80 //line views/hypha.qtpl:40
} }

View File

@ -1,7 +1,5 @@
{% import "strings" %}
{% import "github.com/bouncepaw/mycorrhiza/cfg" %} {% import "github.com/bouncepaw/mycorrhiza/cfg" %}
{% import "github.com/bouncepaw/mycorrhiza/backlinks" %} {% import "github.com/bouncepaw/mycorrhiza/backlinks" %}
{% import "github.com/bouncepaw/mycorrhiza/l18n" %}
{% import "github.com/bouncepaw/mycorrhiza/user" %} {% import "github.com/bouncepaw/mycorrhiza/user" %}
{% import "github.com/bouncepaw/mycorrhiza/hyphae" %} {% import "github.com/bouncepaw/mycorrhiza/hyphae" %}
{% import "github.com/bouncepaw/mycorrhiza/viewutil" %} {% import "github.com/bouncepaw/mycorrhiza/viewutil" %}
@ -32,28 +30,6 @@
</nav> </nav>
{% endfunc %} {% endfunc %}
{% func siblingHyphae(siblings string, lc *l18n.Localizer) %}
{% if cfg.UseSiblingHyphaeSidebar %}
<aside class="sibling-hyphae layout-card">
<h2 class="sibling-hyphae__title layout-card__title">{%s lc.Get("ui.sibling_hyphae") %}</h2>
{%s= siblings %}
</aside>
{% endif %}
{% endfunc %}
{% func Subhyphae(subhyphae string, lc *l18n.Localizer) %}
{% if strings.TrimSpace(subhyphae) != "" %}
<section class="subhyphae">
<h2 class="subhyphae__title">{%s lc.Get("ui.subhyphae") %}</h2>
<nav class="subhyphae__nav">
<ul class="subhyphae__list">
{%s= subhyphae %}
</ul>
</nav>
</section>
{% endif %}
{% endfunc %}
{% func commonScripts() %} {% func commonScripts() %}
{% for _, scriptPath := range cfg.CommonScripts %} {% for _, scriptPath := range cfg.CommonScripts %}
<script src="{%s scriptPath %}"></script> <script src="{%s scriptPath %}"></script>

View File

@ -5,339 +5,217 @@
package views package views
//line views/nav.qtpl:1 //line views/nav.qtpl:1
import "strings"
//line views/nav.qtpl:2
import "github.com/bouncepaw/mycorrhiza/cfg" import "github.com/bouncepaw/mycorrhiza/cfg"
//line views/nav.qtpl:3 //line views/nav.qtpl:2
import "github.com/bouncepaw/mycorrhiza/backlinks" import "github.com/bouncepaw/mycorrhiza/backlinks"
//line views/nav.qtpl:4 //line views/nav.qtpl:3
import "github.com/bouncepaw/mycorrhiza/l18n"
//line views/nav.qtpl:5
import "github.com/bouncepaw/mycorrhiza/user" import "github.com/bouncepaw/mycorrhiza/user"
//line views/nav.qtpl:6 //line views/nav.qtpl:4
import "github.com/bouncepaw/mycorrhiza/hyphae" import "github.com/bouncepaw/mycorrhiza/hyphae"
//line views/nav.qtpl:7 //line views/nav.qtpl:5
import "github.com/bouncepaw/mycorrhiza/viewutil" import "github.com/bouncepaw/mycorrhiza/viewutil"
//line views/nav.qtpl:9 //line views/nav.qtpl:7
import ( import (
qtio422016 "io" qtio422016 "io"
qt422016 "github.com/valyala/quicktemplate" qt422016 "github.com/valyala/quicktemplate"
) )
//line views/nav.qtpl:9 //line views/nav.qtpl:7
var ( var (
_ = qtio422016.Copy _ = qtio422016.Copy
_ = qt422016.AcquireByteBuffer _ = qt422016.AcquireByteBuffer
) )
//line views/nav.qtpl:9 //line views/nav.qtpl:7
func streamhyphaInfoEntry(qw422016 *qt422016.Writer, h hyphae.Hypha, u *user.User, action, displayText string) { func streamhyphaInfoEntry(qw422016 *qt422016.Writer, h hyphae.Hypha, u *user.User, action, displayText string) {
//line views/nav.qtpl:9 //line views/nav.qtpl:7
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/nav.qtpl:10 //line views/nav.qtpl:8
if u.CanProceed(action) { if u.CanProceed(action) {
//line views/nav.qtpl:10 //line views/nav.qtpl:8
qw422016.N().S(` qw422016.N().S(`
<li class="hypha-info__entry hypha-info__entry_`) <li class="hypha-info__entry hypha-info__entry_`)
//line views/nav.qtpl:11 //line views/nav.qtpl:9
qw422016.E().S(action) qw422016.E().S(action)
//line views/nav.qtpl:11 //line views/nav.qtpl:9
qw422016.N().S(`"> qw422016.N().S(`">
<a class="hypha-info__link" href="/`) <a class="hypha-info__link" href="/`)
//line views/nav.qtpl:12 //line views/nav.qtpl:10
qw422016.E().S(action) qw422016.E().S(action)
//line views/nav.qtpl:12 //line views/nav.qtpl:10
qw422016.N().S(`/`) qw422016.N().S(`/`)
//line views/nav.qtpl:12 //line views/nav.qtpl:10
qw422016.E().S(h.CanonicalName()) qw422016.E().S(h.CanonicalName())
//line views/nav.qtpl:12 //line views/nav.qtpl:10
qw422016.N().S(`">`) qw422016.N().S(`">`)
//line views/nav.qtpl:12 //line views/nav.qtpl:10
qw422016.E().S(displayText) qw422016.E().S(displayText)
//line views/nav.qtpl:12 //line views/nav.qtpl:10
qw422016.N().S(`</a> qw422016.N().S(`</a>
</li> </li>
`) `)
//line views/nav.qtpl:14 //line views/nav.qtpl:12
} }
//line views/nav.qtpl:14 //line views/nav.qtpl:12
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/nav.qtpl:15 //line views/nav.qtpl:13
} }
//line views/nav.qtpl:15 //line views/nav.qtpl:13
func writehyphaInfoEntry(qq422016 qtio422016.Writer, h hyphae.Hypha, u *user.User, action, displayText string) { func writehyphaInfoEntry(qq422016 qtio422016.Writer, h hyphae.Hypha, u *user.User, action, displayText string) {
//line views/nav.qtpl:15 //line views/nav.qtpl:13
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line views/nav.qtpl:15 //line views/nav.qtpl:13
streamhyphaInfoEntry(qw422016, h, u, action, displayText) streamhyphaInfoEntry(qw422016, h, u, action, displayText)
//line views/nav.qtpl:15 //line views/nav.qtpl:13
qt422016.ReleaseWriter(qw422016) qt422016.ReleaseWriter(qw422016)
//line views/nav.qtpl:15 //line views/nav.qtpl:13
} }
//line views/nav.qtpl:15 //line views/nav.qtpl:13
func hyphaInfoEntry(h hyphae.Hypha, u *user.User, action, displayText string) string { func hyphaInfoEntry(h hyphae.Hypha, u *user.User, action, displayText string) string {
//line views/nav.qtpl:15 //line views/nav.qtpl:13
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line views/nav.qtpl:15 //line views/nav.qtpl:13
writehyphaInfoEntry(qb422016, h, u, action, displayText) writehyphaInfoEntry(qb422016, h, u, action, displayText)
//line views/nav.qtpl:15 //line views/nav.qtpl:13
qs422016 := string(qb422016.B) qs422016 := string(qb422016.B)
//line views/nav.qtpl:15 //line views/nav.qtpl:13
qt422016.ReleaseByteBuffer(qb422016) qt422016.ReleaseByteBuffer(qb422016)
//line views/nav.qtpl:15 //line views/nav.qtpl:13
return qs422016 return qs422016
//line views/nav.qtpl:15 //line views/nav.qtpl:13
} }
//line views/nav.qtpl:17 //line views/nav.qtpl:15
func streamhyphaInfo(qw422016 *qt422016.Writer, meta viewutil.Meta, h hyphae.Hypha) { func streamhyphaInfo(qw422016 *qt422016.Writer, meta viewutil.Meta, h hyphae.Hypha) {
//line views/nav.qtpl:17 //line views/nav.qtpl:15
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/nav.qtpl:19 //line views/nav.qtpl:17
u := meta.U u := meta.U
lc := meta.Lc lc := meta.Lc
backs := backlinks.BacklinksCount(h) backs := backlinks.BacklinksCount(h)
//line views/nav.qtpl:22 //line views/nav.qtpl:20
qw422016.N().S(` qw422016.N().S(`
<nav class="hypha-info"> <nav class="hypha-info">
<ul class="hypha-info__list"> <ul class="hypha-info__list">
`) `)
//line views/nav.qtpl:25 //line views/nav.qtpl:23
streamhyphaInfoEntry(qw422016, h, u, "history", lc.Get("ui.history_link")) streamhyphaInfoEntry(qw422016, h, u, "history", lc.Get("ui.history_link"))
//line views/nav.qtpl:23
qw422016.N().S(`
`)
//line views/nav.qtpl:24
streamhyphaInfoEntry(qw422016, h, u, "rename", lc.Get("ui.rename_link"))
//line views/nav.qtpl:24
qw422016.N().S(`
`)
//line views/nav.qtpl:25
streamhyphaInfoEntry(qw422016, h, u, "delete", lc.Get("ui.delete_link"))
//line views/nav.qtpl:25 //line views/nav.qtpl:25
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/nav.qtpl:26 //line views/nav.qtpl:26
streamhyphaInfoEntry(qw422016, h, u, "rename", lc.Get("ui.rename_link")) streamhyphaInfoEntry(qw422016, h, u, "text", lc.Get("ui.text_link"))
//line views/nav.qtpl:26 //line views/nav.qtpl:26
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/nav.qtpl:27 //line views/nav.qtpl:27
streamhyphaInfoEntry(qw422016, h, u, "delete", lc.Get("ui.delete_link")) streamhyphaInfoEntry(qw422016, h, u, "media", lc.Get("ui.media_link"))
//line views/nav.qtpl:27 //line views/nav.qtpl:27
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/nav.qtpl:28 //line views/nav.qtpl:28
streamhyphaInfoEntry(qw422016, h, u, "text", lc.Get("ui.text_link"))
//line views/nav.qtpl:28
qw422016.N().S(`
`)
//line views/nav.qtpl:29
streamhyphaInfoEntry(qw422016, h, u, "media", lc.Get("ui.media_link"))
//line views/nav.qtpl:29
qw422016.N().S(`
`)
//line views/nav.qtpl:30
streamhyphaInfoEntry(qw422016, h, u, "backlinks", lc.GetPlural("ui.backlinks_link", backs)) streamhyphaInfoEntry(qw422016, h, u, "backlinks", lc.GetPlural("ui.backlinks_link", backs))
//line views/nav.qtpl:30 //line views/nav.qtpl:28
qw422016.N().S(` qw422016.N().S(`
</ul> </ul>
</nav> </nav>
`) `)
//line views/nav.qtpl:33 //line views/nav.qtpl:31
} }
//line views/nav.qtpl:33 //line views/nav.qtpl:31
func writehyphaInfo(qq422016 qtio422016.Writer, meta viewutil.Meta, h hyphae.Hypha) { func writehyphaInfo(qq422016 qtio422016.Writer, meta viewutil.Meta, h hyphae.Hypha) {
//line views/nav.qtpl:33 //line views/nav.qtpl:31
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line views/nav.qtpl:33 //line views/nav.qtpl:31
streamhyphaInfo(qw422016, meta, h) streamhyphaInfo(qw422016, meta, h)
//line views/nav.qtpl:33 //line views/nav.qtpl:31
qt422016.ReleaseWriter(qw422016) qt422016.ReleaseWriter(qw422016)
//line views/nav.qtpl:33 //line views/nav.qtpl:31
} }
//line views/nav.qtpl:33 //line views/nav.qtpl:31
func hyphaInfo(meta viewutil.Meta, h hyphae.Hypha) string { func hyphaInfo(meta viewutil.Meta, h hyphae.Hypha) string {
//line views/nav.qtpl:33 //line views/nav.qtpl:31
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line views/nav.qtpl:33 //line views/nav.qtpl:31
writehyphaInfo(qb422016, meta, h) writehyphaInfo(qb422016, meta, h)
//line views/nav.qtpl:33 //line views/nav.qtpl:31
qs422016 := string(qb422016.B) qs422016 := string(qb422016.B)
//line views/nav.qtpl:33 //line views/nav.qtpl:31
qt422016.ReleaseByteBuffer(qb422016) qt422016.ReleaseByteBuffer(qb422016)
//line views/nav.qtpl:31
return qs422016
//line views/nav.qtpl:31
}
//line views/nav.qtpl:33 //line views/nav.qtpl:33
return qs422016
//line views/nav.qtpl:33
}
//line views/nav.qtpl:35
func streamsiblingHyphae(qw422016 *qt422016.Writer, siblings string, lc *l18n.Localizer) {
//line views/nav.qtpl:35
qw422016.N().S(`
`)
//line views/nav.qtpl:36
if cfg.UseSiblingHyphaeSidebar {
//line views/nav.qtpl:36
qw422016.N().S(`
<aside class="sibling-hyphae layout-card">
<h2 class="sibling-hyphae__title layout-card__title">`)
//line views/nav.qtpl:38
qw422016.E().S(lc.Get("ui.sibling_hyphae"))
//line views/nav.qtpl:38
qw422016.N().S(`</h2>
`)
//line views/nav.qtpl:39
qw422016.N().S(siblings)
//line views/nav.qtpl:39
qw422016.N().S(`
</aside>
`)
//line views/nav.qtpl:41
}
//line views/nav.qtpl:41
qw422016.N().S(`
`)
//line views/nav.qtpl:42
}
//line views/nav.qtpl:42
func writesiblingHyphae(qq422016 qtio422016.Writer, siblings string, lc *l18n.Localizer) {
//line views/nav.qtpl:42
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/nav.qtpl:42
streamsiblingHyphae(qw422016, siblings, lc)
//line views/nav.qtpl:42
qt422016.ReleaseWriter(qw422016)
//line views/nav.qtpl:42
}
//line views/nav.qtpl:42
func siblingHyphae(siblings string, lc *l18n.Localizer) string {
//line views/nav.qtpl:42
qb422016 := qt422016.AcquireByteBuffer()
//line views/nav.qtpl:42
writesiblingHyphae(qb422016, siblings, lc)
//line views/nav.qtpl:42
qs422016 := string(qb422016.B)
//line views/nav.qtpl:42
qt422016.ReleaseByteBuffer(qb422016)
//line views/nav.qtpl:42
return qs422016
//line views/nav.qtpl:42
}
//line views/nav.qtpl:44
func StreamSubhyphae(qw422016 *qt422016.Writer, subhyphae string, lc *l18n.Localizer) {
//line views/nav.qtpl:44
qw422016.N().S(`
`)
//line views/nav.qtpl:45
if strings.TrimSpace(subhyphae) != "" {
//line views/nav.qtpl:45
qw422016.N().S(`
<section class="subhyphae">
<h2 class="subhyphae__title">`)
//line views/nav.qtpl:47
qw422016.E().S(lc.Get("ui.subhyphae"))
//line views/nav.qtpl:47
qw422016.N().S(`</h2>
<nav class="subhyphae__nav">
<ul class="subhyphae__list">
`)
//line views/nav.qtpl:50
qw422016.N().S(subhyphae)
//line views/nav.qtpl:50
qw422016.N().S(`
</ul>
</nav>
</section>
`)
//line views/nav.qtpl:54
}
//line views/nav.qtpl:54
qw422016.N().S(`
`)
//line views/nav.qtpl:55
}
//line views/nav.qtpl:55
func WriteSubhyphae(qq422016 qtio422016.Writer, subhyphae string, lc *l18n.Localizer) {
//line views/nav.qtpl:55
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/nav.qtpl:55
StreamSubhyphae(qw422016, subhyphae, lc)
//line views/nav.qtpl:55
qt422016.ReleaseWriter(qw422016)
//line views/nav.qtpl:55
}
//line views/nav.qtpl:55
func Subhyphae(subhyphae string, lc *l18n.Localizer) string {
//line views/nav.qtpl:55
qb422016 := qt422016.AcquireByteBuffer()
//line views/nav.qtpl:55
WriteSubhyphae(qb422016, subhyphae, lc)
//line views/nav.qtpl:55
qs422016 := string(qb422016.B)
//line views/nav.qtpl:55
qt422016.ReleaseByteBuffer(qb422016)
//line views/nav.qtpl:55
return qs422016
//line views/nav.qtpl:55
}
//line views/nav.qtpl:57
func streamcommonScripts(qw422016 *qt422016.Writer) { func streamcommonScripts(qw422016 *qt422016.Writer) {
//line views/nav.qtpl:57 //line views/nav.qtpl:33
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/nav.qtpl:58 //line views/nav.qtpl:34
for _, scriptPath := range cfg.CommonScripts { for _, scriptPath := range cfg.CommonScripts {
//line views/nav.qtpl:58 //line views/nav.qtpl:34
qw422016.N().S(` qw422016.N().S(`
<script src="`) <script src="`)
//line views/nav.qtpl:59 //line views/nav.qtpl:35
qw422016.E().S(scriptPath) qw422016.E().S(scriptPath)
//line views/nav.qtpl:59 //line views/nav.qtpl:35
qw422016.N().S(`"></script> qw422016.N().S(`"></script>
`) `)
//line views/nav.qtpl:60 //line views/nav.qtpl:36
} }
//line views/nav.qtpl:60 //line views/nav.qtpl:36
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/nav.qtpl:61 //line views/nav.qtpl:37
} }
//line views/nav.qtpl:61 //line views/nav.qtpl:37
func writecommonScripts(qq422016 qtio422016.Writer) { func writecommonScripts(qq422016 qtio422016.Writer) {
//line views/nav.qtpl:61 //line views/nav.qtpl:37
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line views/nav.qtpl:61 //line views/nav.qtpl:37
streamcommonScripts(qw422016) streamcommonScripts(qw422016)
//line views/nav.qtpl:61 //line views/nav.qtpl:37
qt422016.ReleaseWriter(qw422016) qt422016.ReleaseWriter(qw422016)
//line views/nav.qtpl:61 //line views/nav.qtpl:37
} }
//line views/nav.qtpl:61 //line views/nav.qtpl:37
func commonScripts() string { func commonScripts() string {
//line views/nav.qtpl:61 //line views/nav.qtpl:37
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line views/nav.qtpl:61 //line views/nav.qtpl:37
writecommonScripts(qb422016) writecommonScripts(qb422016)
//line views/nav.qtpl:61 //line views/nav.qtpl:37
qs422016 := string(qb422016.B) qs422016 := string(qb422016.B)
//line views/nav.qtpl:61 //line views/nav.qtpl:37
qt422016.ReleaseByteBuffer(qb422016) qt422016.ReleaseByteBuffer(qb422016)
//line views/nav.qtpl:61 //line views/nav.qtpl:37
return qs422016 return qs422016
//line views/nav.qtpl:61 //line views/nav.qtpl:37
} }

View File

@ -113,7 +113,7 @@ If you rename .prevnext, change the docs too.
{%s= hypview.NaviTitle(meta, h.CanonicalName()) %} {%s= hypview.NaviTitle(meta, h.CanonicalName()) %}
{% switch h.(type) %} {% switch h.(type) %}
{% case *hyphae.EmptyHypha %} {% case *hyphae.EmptyHypha %}
{%= nonExistentHyphaNotice(h, meta.U, meta.Lc) %} {%s= hypview.EmptyHypha(meta, h.CanonicalName()) %}
{% default %} {% default %}
{%s= contents %} {%s= contents %}
{% endswitch %} {% endswitch %}
@ -126,13 +126,27 @@ If you rename .prevnext, change the docs too.
<a class="prevnext__el prevnext__next" href="/hypha/{%s nextHyphaName %}" rel="next">{%s util.BeautifulName(path.Base(nextHyphaName)) %} →</a> <a class="prevnext__el prevnext__next" href="/hypha/{%s nextHyphaName %}" rel="next">{%s util.BeautifulName(path.Base(nextHyphaName)) %} →</a>
{% endif %} {% endif %}
</section> </section>
{%= Subhyphae(subhyphae, meta.Lc) %} {% if strings.TrimSpace(subhyphae) != "" %}
<section class="subhyphae">
<h2 class="subhyphae__title">{%s lc.Get("ui.subhyphae") %}</h2>
<nav class="subhyphae__nav">
<ul class="subhyphae__list">
{%s= subhyphae %}
</ul>
</nav>
</section>
{% endif %}
<section id="hypha-bottom"> <section id="hypha-bottom">
{%= hyphaInfo(meta, h) %} {%= hyphaInfo(meta, h) %}
</section> </section>
</main> </main>
{%s= categories.CategoryCard(meta, h.CanonicalName()) %} {%s= categories.CategoryCard(meta, h.CanonicalName()) %}
{%= siblingHyphae(siblings, meta.Lc) %} {% if cfg.UseSiblingHyphaeSidebar %}
<aside class="sibling-hyphae layout-card">
<h2 class="sibling-hyphae__title layout-card__title">{%s lc.Get("ui.sibling_hyphae") %}</h2>
{%s= siblings %}
</aside>
{% endif %}
{%= viewScripts() %} {%= viewScripts() %}
{% endfunc %} {% endfunc %}

View File

@ -401,7 +401,7 @@ func StreamHypha(qw422016 *qt422016.Writer, meta viewutil.Meta, h hyphae.Hypha,
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/readers.qtpl:116 //line views/readers.qtpl:116
streamnonExistentHyphaNotice(qw422016, h, meta.U, meta.Lc) qw422016.N().S(hypview.EmptyHypha(meta, h.CanonicalName()))
//line views/readers.qtpl:116 //line views/readers.qtpl:116
qw422016.N().S(` qw422016.N().S(`
`) `)
@ -462,177 +462,215 @@ func StreamHypha(qw422016 *qt422016.Writer, meta viewutil.Meta, h hyphae.Hypha,
</section> </section>
`) `)
//line views/readers.qtpl:129 //line views/readers.qtpl:129
StreamSubhyphae(qw422016, subhyphae, meta.Lc) if strings.TrimSpace(subhyphae) != "" {
//line views/readers.qtpl:129 //line views/readers.qtpl:129
qw422016.N().S(`
<section class="subhyphae">
<h2 class="subhyphae__title">`)
//line views/readers.qtpl:131
qw422016.E().S(lc.Get("ui.subhyphae"))
//line views/readers.qtpl:131
qw422016.N().S(`</h2>
<nav class="subhyphae__nav">
<ul class="subhyphae__list">
`)
//line views/readers.qtpl:134
qw422016.N().S(subhyphae)
//line views/readers.qtpl:134
qw422016.N().S(`
</ul>
</nav>
</section>
`)
//line views/readers.qtpl:138
}
//line views/readers.qtpl:138
qw422016.N().S(` qw422016.N().S(`
<section id="hypha-bottom"> <section id="hypha-bottom">
`) `)
//line views/readers.qtpl:131 //line views/readers.qtpl:140
streamhyphaInfo(qw422016, meta, h) streamhyphaInfo(qw422016, meta, h)
//line views/readers.qtpl:131 //line views/readers.qtpl:140
qw422016.N().S(` qw422016.N().S(`
</section> </section>
</main> </main>
`) `)
//line views/readers.qtpl:134 //line views/readers.qtpl:143
qw422016.N().S(categories.CategoryCard(meta, h.CanonicalName())) qw422016.N().S(categories.CategoryCard(meta, h.CanonicalName()))
//line views/readers.qtpl:134 //line views/readers.qtpl:143
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/readers.qtpl:135 //line views/readers.qtpl:144
streamsiblingHyphae(qw422016, siblings, meta.Lc) if cfg.UseSiblingHyphaeSidebar {
//line views/readers.qtpl:135 //line views/readers.qtpl:144
qw422016.N().S(`
<aside class="sibling-hyphae layout-card">
<h2 class="sibling-hyphae__title layout-card__title">`)
//line views/readers.qtpl:146
qw422016.E().S(lc.Get("ui.sibling_hyphae"))
//line views/readers.qtpl:146
qw422016.N().S(`</h2>
`)
//line views/readers.qtpl:147
qw422016.N().S(siblings)
//line views/readers.qtpl:147
qw422016.N().S(`
</aside>
`)
//line views/readers.qtpl:149
}
//line views/readers.qtpl:149
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/readers.qtpl:136 //line views/readers.qtpl:150
streamviewScripts(qw422016) streamviewScripts(qw422016)
//line views/readers.qtpl:136 //line views/readers.qtpl:150
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/readers.qtpl:137 //line views/readers.qtpl:151
} }
//line views/readers.qtpl:137 //line views/readers.qtpl:151
func WriteHypha(qq422016 qtio422016.Writer, meta viewutil.Meta, h hyphae.Hypha, contents string) { func WriteHypha(qq422016 qtio422016.Writer, meta viewutil.Meta, h hyphae.Hypha, contents string) {
//line views/readers.qtpl:137 //line views/readers.qtpl:151
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line views/readers.qtpl:137 //line views/readers.qtpl:151
StreamHypha(qw422016, meta, h, contents) StreamHypha(qw422016, meta, h, contents)
//line views/readers.qtpl:137 //line views/readers.qtpl:151
qt422016.ReleaseWriter(qw422016) qt422016.ReleaseWriter(qw422016)
//line views/readers.qtpl:137 //line views/readers.qtpl:151
} }
//line views/readers.qtpl:137 //line views/readers.qtpl:151
func Hypha(meta viewutil.Meta, h hyphae.Hypha, contents string) string { func Hypha(meta viewutil.Meta, h hyphae.Hypha, contents string) string {
//line views/readers.qtpl:137 //line views/readers.qtpl:151
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line views/readers.qtpl:137 //line views/readers.qtpl:151
WriteHypha(qb422016, meta, h, contents) WriteHypha(qb422016, meta, h, contents)
//line views/readers.qtpl:137 //line views/readers.qtpl:151
qs422016 := string(qb422016.B) qs422016 := string(qb422016.B)
//line views/readers.qtpl:137 //line views/readers.qtpl:151
qt422016.ReleaseByteBuffer(qb422016) qt422016.ReleaseByteBuffer(qb422016)
//line views/readers.qtpl:137 //line views/readers.qtpl:151
return qs422016 return qs422016
//line views/readers.qtpl:137 //line views/readers.qtpl:151
} }
//line views/readers.qtpl:139 //line views/readers.qtpl:153
func StreamRevision(qw422016 *qt422016.Writer, meta viewutil.Meta, h hyphae.Hypha, contents, revHash string) { func StreamRevision(qw422016 *qt422016.Writer, meta viewutil.Meta, h hyphae.Hypha, contents, revHash string) {
//line views/readers.qtpl:139 //line views/readers.qtpl:153
qw422016.N().S(` qw422016.N().S(`
<main class="main-width"> <main class="main-width">
<section> <section>
<p>`) <p>`)
//line views/readers.qtpl:142 //line views/readers.qtpl:156
qw422016.E().S(meta.Lc.Get("ui.revision_warning")) qw422016.E().S(meta.Lc.Get("ui.revision_warning"))
//line views/readers.qtpl:142 //line views/readers.qtpl:156
qw422016.N().S(` <a href="/rev-text/`) qw422016.N().S(` <a href="/rev-text/`)
//line views/readers.qtpl:142 //line views/readers.qtpl:156
qw422016.E().S(revHash) qw422016.E().S(revHash)
//line views/readers.qtpl:142 //line views/readers.qtpl:156
qw422016.N().S(`/`) qw422016.N().S(`/`)
//line views/readers.qtpl:142 //line views/readers.qtpl:156
qw422016.E().S(h.CanonicalName()) qw422016.E().S(h.CanonicalName())
//line views/readers.qtpl:142 //line views/readers.qtpl:156
qw422016.N().S(`">`) qw422016.N().S(`">`)
//line views/readers.qtpl:142 //line views/readers.qtpl:156
qw422016.E().S(meta.Lc.Get("ui.revision_link")) qw422016.E().S(meta.Lc.Get("ui.revision_link"))
//line views/readers.qtpl:142 //line views/readers.qtpl:156
qw422016.N().S(`</a></p> qw422016.N().S(`</a></p>
`) `)
//line views/readers.qtpl:143 //line views/readers.qtpl:157
qw422016.N().S(hypview.NaviTitle(meta, h.CanonicalName())) qw422016.N().S(hypview.NaviTitle(meta, h.CanonicalName()))
//line views/readers.qtpl:143 //line views/readers.qtpl:157
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/readers.qtpl:144 //line views/readers.qtpl:158
qw422016.N().S(contents) qw422016.N().S(contents)
//line views/readers.qtpl:144 //line views/readers.qtpl:158
qw422016.N().S(` qw422016.N().S(`
</section> </section>
</main> </main>
`) `)
//line views/readers.qtpl:147 //line views/readers.qtpl:161
streamviewScripts(qw422016) streamviewScripts(qw422016)
//line views/readers.qtpl:147 //line views/readers.qtpl:161
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/readers.qtpl:148 //line views/readers.qtpl:162
} }
//line views/readers.qtpl:148 //line views/readers.qtpl:162
func WriteRevision(qq422016 qtio422016.Writer, meta viewutil.Meta, h hyphae.Hypha, contents, revHash string) { func WriteRevision(qq422016 qtio422016.Writer, meta viewutil.Meta, h hyphae.Hypha, contents, revHash string) {
//line views/readers.qtpl:148 //line views/readers.qtpl:162
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line views/readers.qtpl:148 //line views/readers.qtpl:162
StreamRevision(qw422016, meta, h, contents, revHash) StreamRevision(qw422016, meta, h, contents, revHash)
//line views/readers.qtpl:148 //line views/readers.qtpl:162
qt422016.ReleaseWriter(qw422016) qt422016.ReleaseWriter(qw422016)
//line views/readers.qtpl:148 //line views/readers.qtpl:162
} }
//line views/readers.qtpl:148 //line views/readers.qtpl:162
func Revision(meta viewutil.Meta, h hyphae.Hypha, contents, revHash string) string { func Revision(meta viewutil.Meta, h hyphae.Hypha, contents, revHash string) string {
//line views/readers.qtpl:148 //line views/readers.qtpl:162
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line views/readers.qtpl:148 //line views/readers.qtpl:162
WriteRevision(qb422016, meta, h, contents, revHash) WriteRevision(qb422016, meta, h, contents, revHash)
//line views/readers.qtpl:148 //line views/readers.qtpl:162
qs422016 := string(qb422016.B) qs422016 := string(qb422016.B)
//line views/readers.qtpl:148 //line views/readers.qtpl:162
qt422016.ReleaseByteBuffer(qb422016) qt422016.ReleaseByteBuffer(qb422016)
//line views/readers.qtpl:148 //line views/readers.qtpl:162
return qs422016 return qs422016
//line views/readers.qtpl:148 //line views/readers.qtpl:162
} }
//line views/readers.qtpl:150 //line views/readers.qtpl:164
func streamviewScripts(qw422016 *qt422016.Writer) { func streamviewScripts(qw422016 *qt422016.Writer) {
//line views/readers.qtpl:150 //line views/readers.qtpl:164
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/readers.qtpl:151 //line views/readers.qtpl:165
for _, scriptPath := range cfg.ViewScripts { for _, scriptPath := range cfg.ViewScripts {
//line views/readers.qtpl:151 //line views/readers.qtpl:165
qw422016.N().S(` qw422016.N().S(`
<script src="`) <script src="`)
//line views/readers.qtpl:152 //line views/readers.qtpl:166
qw422016.E().S(scriptPath) qw422016.E().S(scriptPath)
//line views/readers.qtpl:152 //line views/readers.qtpl:166
qw422016.N().S(`"></script> qw422016.N().S(`"></script>
`) `)
//line views/readers.qtpl:153 //line views/readers.qtpl:167
} }
//line views/readers.qtpl:153 //line views/readers.qtpl:167
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/readers.qtpl:154 //line views/readers.qtpl:168
} }
//line views/readers.qtpl:154 //line views/readers.qtpl:168
func writeviewScripts(qq422016 qtio422016.Writer) { func writeviewScripts(qq422016 qtio422016.Writer) {
//line views/readers.qtpl:154 //line views/readers.qtpl:168
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line views/readers.qtpl:154 //line views/readers.qtpl:168
streamviewScripts(qw422016) streamviewScripts(qw422016)
//line views/readers.qtpl:154 //line views/readers.qtpl:168
qt422016.ReleaseWriter(qw422016) qt422016.ReleaseWriter(qw422016)
//line views/readers.qtpl:154 //line views/readers.qtpl:168
} }
//line views/readers.qtpl:154 //line views/readers.qtpl:168
func viewScripts() string { func viewScripts() string {
//line views/readers.qtpl:154 //line views/readers.qtpl:168
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line views/readers.qtpl:154 //line views/readers.qtpl:168
writeviewScripts(qb422016) writeviewScripts(qb422016)
//line views/readers.qtpl:154 //line views/readers.qtpl:168
qs422016 := string(qb422016.B) qs422016 := string(qb422016.B)
//line views/readers.qtpl:154 //line views/readers.qtpl:168
qt422016.ReleaseByteBuffer(qb422016) qt422016.ReleaseByteBuffer(qb422016)
//line views/readers.qtpl:154 //line views/readers.qtpl:168
return qs422016 return qs422016
//line views/readers.qtpl:154 //line views/readers.qtpl:168
} }