1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2025-01-08 02:40:26 +00:00

Reimplement Navititle with go templates

That was rough
This commit is contained in:
Timur Ismagilov 2022-04-23 23:35:36 +03:00
parent d7b4ea9002
commit 59deabd0d1
9 changed files with 487 additions and 527 deletions

62
hypview/hypview.go Normal file
View File

@ -0,0 +1,62 @@
package hypview
import (
"embed"
"fmt"
"github.com/bouncepaw/mycorrhiza/cfg"
"github.com/bouncepaw/mycorrhiza/viewutil"
"log"
"strings"
"text/template"
)
var (
//go:embed *.html
fs embed.FS
ruTranslation = ``
chainNaviTitle viewutil.Chain
)
func Init() {
chainNaviTitle = viewutil.
En(viewutil.CopyEnWith(fs, "view_navititle.html")).
Ru(template.Must(viewutil.CopyRuWith(fs, "view_navititle.html").Parse(ruTranslation)))
}
type naviTitleData struct {
HyphaNameParts []string
HyphaNamePartsWithParents []string
Icon string
HomeHypha string
}
func NaviTitle(meta viewutil.Meta, hyphaName string) string {
parts, partsWithParents := naviTitleify(hyphaName)
var buf strings.Builder
err := chainNaviTitle.Get(meta).ExecuteTemplate(&buf, "navititle", naviTitleData{
HyphaNameParts: parts,
HyphaNamePartsWithParents: partsWithParents,
Icon: cfg.NaviTitleIcon,
HomeHypha: cfg.HomeHypha,
})
if err != nil {
log.Println(err)
}
return buf.String()
}
func naviTitleify(hyphaName string) ([]string, []string) {
var (
prevAcc = "/hypha"
parts = strings.Split(hyphaName, "/")
partsWithParents []string
)
for _, part := range parts {
prevAcc += "/" + part
partsWithParents = append(partsWithParents, prevAcc)
}
fmt.Printf("%q — %q\n", parts, partsWithParents)
return parts, partsWithParents
}

View File

@ -0,0 +1,17 @@
{{define "navititle"}}
<h1 class="navi-title">
{{- $withParents := .HyphaNamePartsWithParents -}}
{{- $parts := .HyphaNameParts -}}
<a href="/hypha/{{.HomeHypha}}">
{{- .Icon -}}
<span aria-hidden="true" class="navi-title__colon">:</span></a>
{{- range $i, $part := .HyphaNameParts -}}
{{- if gt $i 0 -}}
<span aria-hidden="true" class="navi-title__separator">/</span>
{{- end -}}
<a href="{{index $withParents $i}}" rel="{{if len $parts | eq (inc $i)}}bookmark{{else}}up{{end}}">
{{- beautifulName $part -}}
</a>
{{- end}}
</h1>
{{end}}

View File

@ -1,5 +1,4 @@
{% import "path/filepath" %} {% import "path/filepath" %}
{% import "strings" %}
{% import "github.com/bouncepaw/mycorrhiza/cfg" %} {% import "github.com/bouncepaw/mycorrhiza/cfg" %}
{% import "github.com/bouncepaw/mycorrhiza/hyphae" %} {% import "github.com/bouncepaw/mycorrhiza/hyphae" %}
@ -47,34 +46,6 @@
</section> </section>
{% endfunc %} {% endfunc %}
{% func NaviTitle(h hyphae.Hypha) %}
{% code
var (
prevAcc = "/hypha/"
parts = strings.Split(h.CanonicalName(), "/")
)
%}
<h1 class="navi-title">
{% stripspace %}
<a href="/hypha/{%s cfg.HomeHypha %}">
{%-s= cfg.NaviTitleIcon -%}
<span aria-hidden="true" class="navi-title__colon">:</span>
</a>
{% for i, part := range parts %}
{% if i > 0 %}
<span aria-hidden="true" class="navi-title__separator">/</span>
{% endif %}
<a href="{%s prevAcc + part %}" rel="{% if i == len(parts) - 1 %}bookmark{% else %}up{% endif %}">
{%s= util.BeautifulName(part) %}
</a>
{% code prevAcc += part + "/" %}
{% endfor %}
{% endstripspace %}
</h1>
{% 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

@ -7,204 +7,201 @@ package views
//line views/hypha.qtpl:1 //line views/hypha.qtpl:1
import "path/filepath" import "path/filepath"
//line views/hypha.qtpl:2 //line views/hypha.qtpl:3
import "strings"
//line views/hypha.qtpl:4
import "github.com/bouncepaw/mycorrhiza/cfg" import "github.com/bouncepaw/mycorrhiza/cfg"
//line views/hypha.qtpl:5 //line views/hypha.qtpl:4
import "github.com/bouncepaw/mycorrhiza/hyphae" import "github.com/bouncepaw/mycorrhiza/hyphae"
//line views/hypha.qtpl:6 //line views/hypha.qtpl:5
import "github.com/bouncepaw/mycorrhiza/l18n" import "github.com/bouncepaw/mycorrhiza/l18n"
//line views/hypha.qtpl:7 //line views/hypha.qtpl:6
import "github.com/bouncepaw/mycorrhiza/user" import "github.com/bouncepaw/mycorrhiza/user"
//line views/hypha.qtpl:8 //line views/hypha.qtpl:7
import "github.com/bouncepaw/mycorrhiza/util" import "github.com/bouncepaw/mycorrhiza/util"
//line views/hypha.qtpl:10 //line views/hypha.qtpl:9
import ( import (
qtio422016 "io" qtio422016 "io"
qt422016 "github.com/valyala/quicktemplate" qt422016 "github.com/valyala/quicktemplate"
) )
//line views/hypha.qtpl:10 //line views/hypha.qtpl:9
var ( var (
_ = qtio422016.Copy _ = qtio422016.Copy
_ = qt422016.AcquireByteBuffer _ = qt422016.AcquireByteBuffer
) )
//line views/hypha.qtpl:10 //line views/hypha.qtpl:9
func streambeautifulLink(qw422016 *qt422016.Writer, hyphaName string) { func streambeautifulLink(qw422016 *qt422016.Writer, hyphaName string) {
//line views/hypha.qtpl:10 //line views/hypha.qtpl:9
qw422016.N().S(`<a href="/hypha/`) qw422016.N().S(`<a href="/hypha/`)
//line views/hypha.qtpl:10 //line views/hypha.qtpl:9
qw422016.N().S(hyphaName) qw422016.N().S(hyphaName)
//line views/hypha.qtpl:10 //line views/hypha.qtpl:9
qw422016.N().S(`">`) qw422016.N().S(`">`)
//line views/hypha.qtpl:10 //line views/hypha.qtpl:9
qw422016.E().S(util.BeautifulName(hyphaName)) qw422016.E().S(util.BeautifulName(hyphaName))
//line views/hypha.qtpl:10 //line views/hypha.qtpl:9
qw422016.N().S(`</a>`) qw422016.N().S(`</a>`)
//line views/hypha.qtpl:10 //line views/hypha.qtpl:9
} }
//line views/hypha.qtpl:10 //line views/hypha.qtpl:9
func writebeautifulLink(qq422016 qtio422016.Writer, hyphaName string) { func writebeautifulLink(qq422016 qtio422016.Writer, hyphaName string) {
//line views/hypha.qtpl:10 //line views/hypha.qtpl:9
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line views/hypha.qtpl:10 //line views/hypha.qtpl:9
streambeautifulLink(qw422016, hyphaName) streambeautifulLink(qw422016, hyphaName)
//line views/hypha.qtpl:10 //line views/hypha.qtpl:9
qt422016.ReleaseWriter(qw422016) qt422016.ReleaseWriter(qw422016)
//line views/hypha.qtpl:10 //line views/hypha.qtpl:9
} }
//line views/hypha.qtpl:10 //line views/hypha.qtpl:9
func beautifulLink(hyphaName string) string { func beautifulLink(hyphaName string) string {
//line views/hypha.qtpl:10 //line views/hypha.qtpl:9
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line views/hypha.qtpl:10 //line views/hypha.qtpl:9
writebeautifulLink(qb422016, hyphaName) writebeautifulLink(qb422016, hyphaName)
//line views/hypha.qtpl:10 //line views/hypha.qtpl:9
qs422016 := string(qb422016.B) qs422016 := string(qb422016.B)
//line views/hypha.qtpl:10 //line views/hypha.qtpl:9
qt422016.ReleaseByteBuffer(qb422016) qt422016.ReleaseByteBuffer(qb422016)
//line views/hypha.qtpl:10 //line views/hypha.qtpl:9
return qs422016 return qs422016
//line views/hypha.qtpl:10 //line views/hypha.qtpl:9
} }
//line views/hypha.qtpl:12 //line views/hypha.qtpl:11
func streammycoLink(qw422016 *qt422016.Writer, lc *l18n.Localizer) { func streammycoLink(qw422016 *qt422016.Writer, lc *l18n.Localizer) {
//line views/hypha.qtpl:12 //line views/hypha.qtpl:11
qw422016.N().S(`<a href="/help/en/mycomarkup" class="shy-link">`) qw422016.N().S(`<a href="/help/en/mycomarkup" class="shy-link">`)
//line views/hypha.qtpl:12 //line views/hypha.qtpl:11
qw422016.E().S(lc.Get("ui.notexist_write_myco")) qw422016.E().S(lc.Get("ui.notexist_write_myco"))
//line views/hypha.qtpl:12 //line views/hypha.qtpl:11
qw422016.N().S(`</a>`) qw422016.N().S(`</a>`)
//line views/hypha.qtpl:12 //line views/hypha.qtpl:11
} }
//line views/hypha.qtpl:12 //line views/hypha.qtpl:11
func writemycoLink(qq422016 qtio422016.Writer, lc *l18n.Localizer) { func writemycoLink(qq422016 qtio422016.Writer, lc *l18n.Localizer) {
//line views/hypha.qtpl:12 //line views/hypha.qtpl:11
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line views/hypha.qtpl:12 //line views/hypha.qtpl:11
streammycoLink(qw422016, lc) streammycoLink(qw422016, lc)
//line views/hypha.qtpl:12 //line views/hypha.qtpl:11
qt422016.ReleaseWriter(qw422016) qt422016.ReleaseWriter(qw422016)
//line views/hypha.qtpl:12 //line views/hypha.qtpl:11
} }
//line views/hypha.qtpl:12 //line views/hypha.qtpl:11
func mycoLink(lc *l18n.Localizer) string { func mycoLink(lc *l18n.Localizer) string {
//line views/hypha.qtpl:12 //line views/hypha.qtpl:11
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line views/hypha.qtpl:12 //line views/hypha.qtpl:11
writemycoLink(qb422016, lc) writemycoLink(qb422016, lc)
//line views/hypha.qtpl:12 //line views/hypha.qtpl:11
qs422016 := string(qb422016.B) qs422016 := string(qb422016.B)
//line views/hypha.qtpl:12 //line views/hypha.qtpl:11
qt422016.ReleaseByteBuffer(qb422016) qt422016.ReleaseByteBuffer(qb422016)
//line views/hypha.qtpl:12 //line views/hypha.qtpl:11
return qs422016 return qs422016
//line views/hypha.qtpl:12 //line views/hypha.qtpl:11
} }
//line views/hypha.qtpl:14 //line views/hypha.qtpl:13
func streamnonExistentHyphaNotice(qw422016 *qt422016.Writer, h hyphae.Hypha, u *user.User, lc *l18n.Localizer) { func streamnonExistentHyphaNotice(qw422016 *qt422016.Writer, h hyphae.Hypha, u *user.User, lc *l18n.Localizer) {
//line views/hypha.qtpl:14 //line views/hypha.qtpl:13
qw422016.N().S(` qw422016.N().S(`
<section class="non-existent-hypha"> <section class="non-existent-hypha">
<h2 class="non-existent-hypha__title">`) <h2 class="non-existent-hypha__title">`)
//line views/hypha.qtpl:16 //line views/hypha.qtpl:15
qw422016.E().S(lc.Get("ui.notexist_heading")) qw422016.E().S(lc.Get("ui.notexist_heading"))
//line views/hypha.qtpl:16 //line views/hypha.qtpl:15
qw422016.N().S(`</h2> qw422016.N().S(`</h2>
`) `)
//line views/hypha.qtpl:17 //line views/hypha.qtpl:16
if cfg.UseAuth && u.Group == "anon" { if cfg.UseAuth && u.Group == "anon" {
//line views/hypha.qtpl:17 //line views/hypha.qtpl:16
qw422016.N().S(` qw422016.N().S(`
<p>`) <p>`)
//line views/hypha.qtpl:18 //line views/hypha.qtpl:17
qw422016.E().S(lc.Get("ui.notexist_norights")) qw422016.E().S(lc.Get("ui.notexist_norights"))
//line views/hypha.qtpl:18 //line views/hypha.qtpl:17
qw422016.N().S(`</p> qw422016.N().S(`</p>
<ul> <ul>
<li><a href="/login">`) <li><a href="/login">`)
//line views/hypha.qtpl:20 //line views/hypha.qtpl:19
qw422016.E().S(lc.Get("ui.notexist_login")) qw422016.E().S(lc.Get("ui.notexist_login"))
//line views/hypha.qtpl:20 //line views/hypha.qtpl:19
qw422016.N().S(`</a></li> qw422016.N().S(`</a></li>
`) `)
//line views/hypha.qtpl:21 //line views/hypha.qtpl:20
if cfg.AllowRegistration { if cfg.AllowRegistration {
//line views/hypha.qtpl:21 //line views/hypha.qtpl:20
qw422016.N().S(`<li><a href="/register">`) qw422016.N().S(`<li><a href="/register">`)
//line views/hypha.qtpl:21 //line views/hypha.qtpl:20
qw422016.E().S(lc.Get("ui.notexist_register")) qw422016.E().S(lc.Get("ui.notexist_register"))
//line views/hypha.qtpl:21 //line views/hypha.qtpl:20
qw422016.N().S(`</a></li>`) qw422016.N().S(`</a></li>`)
//line views/hypha.qtpl:21 //line views/hypha.qtpl:20
} }
//line views/hypha.qtpl:21 //line views/hypha.qtpl:20
qw422016.N().S(` qw422016.N().S(`
</ul> </ul>
`) `)
//line views/hypha.qtpl:23 //line views/hypha.qtpl:22
} else { } else {
//line views/hypha.qtpl:23 //line views/hypha.qtpl:22
qw422016.N().S(` qw422016.N().S(`
<div class="non-existent-hypha__ways"> <div class="non-existent-hypha__ways">
<section class="non-existent-hypha__way"> <section class="non-existent-hypha__way">
<h3 class="non-existent-hypha__subtitle">📝 `) <h3 class="non-existent-hypha__subtitle">📝 `)
//line views/hypha.qtpl:27 //line views/hypha.qtpl:26
qw422016.E().S(lc.Get("ui.notexist_write")) qw422016.E().S(lc.Get("ui.notexist_write"))
//line views/hypha.qtpl:27 //line views/hypha.qtpl:26
qw422016.N().S(`</h3> qw422016.N().S(`</h3>
<p>`) <p>`)
//line views/hypha.qtpl:28 //line views/hypha.qtpl:27
qw422016.N().S(lc.Get("ui.notexist_write_tip1", &l18n.Replacements{"myco": mycoLink(lc)})) qw422016.N().S(lc.Get("ui.notexist_write_tip1", &l18n.Replacements{"myco": mycoLink(lc)}))
//line views/hypha.qtpl:28 //line views/hypha.qtpl:27
qw422016.N().S(`</p> qw422016.N().S(`</p>
<p>`) <p>`)
//line views/hypha.qtpl:29 //line views/hypha.qtpl:28
qw422016.E().S(lc.Get("ui.notexist_write_tip2")) qw422016.E().S(lc.Get("ui.notexist_write_tip2"))
//line views/hypha.qtpl:29 //line views/hypha.qtpl:28
qw422016.N().S(`</p> qw422016.N().S(`</p>
<a class="btn btn_accent stick-to-bottom" href="/edit/`) <a class="btn btn_accent stick-to-bottom" href="/edit/`)
//line views/hypha.qtpl:30 //line views/hypha.qtpl:29
qw422016.E().S(h.CanonicalName()) qw422016.E().S(h.CanonicalName())
//line views/hypha.qtpl:30 //line views/hypha.qtpl:29
qw422016.N().S(`">`) qw422016.N().S(`">`)
//line views/hypha.qtpl:30 //line views/hypha.qtpl:29
qw422016.E().S(lc.Get("ui.notexist_write_button")) qw422016.E().S(lc.Get("ui.notexist_write_button"))
//line views/hypha.qtpl:30 //line views/hypha.qtpl:29
qw422016.N().S(`</a> qw422016.N().S(`</a>
</section> </section>
<section class="non-existent-hypha__way"> <section class="non-existent-hypha__way">
<h3 class="non-existent-hypha__subtitle">🖼 `) <h3 class="non-existent-hypha__subtitle">🖼 `)
//line views/hypha.qtpl:34 //line views/hypha.qtpl:33
qw422016.E().S(lc.Get("ui.notexist_media")) qw422016.E().S(lc.Get("ui.notexist_media"))
//line views/hypha.qtpl:34 //line views/hypha.qtpl:33
qw422016.N().S(`</h3> qw422016.N().S(`</h3>
<p>`) <p>`)
//line views/hypha.qtpl:35 //line views/hypha.qtpl:34
qw422016.E().S(lc.Get("ui.notexist_media_tip1")) qw422016.E().S(lc.Get("ui.notexist_media_tip1"))
//line views/hypha.qtpl:35 //line views/hypha.qtpl:34
qw422016.N().S(`</p> qw422016.N().S(`</p>
<form action="/upload-binary/`) <form action="/upload-binary/`)
//line views/hypha.qtpl:36 //line views/hypha.qtpl:35
qw422016.E().S(h.CanonicalName()) qw422016.E().S(h.CanonicalName())
//line views/hypha.qtpl:36 //line views/hypha.qtpl:35
qw422016.N().S(`" qw422016.N().S(`"
method="post" enctype="multipart/form-data" method="post" enctype="multipart/form-data"
class="upload-binary"> class="upload-binary">
@ -212,301 +209,208 @@ func streamnonExistentHyphaNotice(qw422016 *qt422016.Writer, h hyphae.Hypha, u *
<input type="file" id="upload-binary__input" name="binary"> <input type="file" id="upload-binary__input" name="binary">
<button type="submit" class="btn stick-to-bottom" value="Upload">`) <button type="submit" class="btn stick-to-bottom" value="Upload">`)
//line views/hypha.qtpl:42 //line views/hypha.qtpl:41
qw422016.E().S(lc.Get("ui.media_upload")) qw422016.E().S(lc.Get("ui.media_upload"))
//line views/hypha.qtpl:42 //line views/hypha.qtpl:41
qw422016.N().S(`</button> qw422016.N().S(`</button>
</form> </form>
</section> </section>
</div> </div>
`) `)
//line views/hypha.qtpl:46 //line views/hypha.qtpl:45
} }
//line views/hypha.qtpl:46 //line views/hypha.qtpl:45
qw422016.N().S(` qw422016.N().S(`
</section> </section>
`) `)
//line views/hypha.qtpl:48 //line views/hypha.qtpl:47
} }
//line views/hypha.qtpl:48 //line views/hypha.qtpl:47
func writenonExistentHyphaNotice(qq422016 qtio422016.Writer, h hyphae.Hypha, u *user.User, lc *l18n.Localizer) { func writenonExistentHyphaNotice(qq422016 qtio422016.Writer, h hyphae.Hypha, u *user.User, lc *l18n.Localizer) {
//line views/hypha.qtpl:48 //line views/hypha.qtpl:47
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line views/hypha.qtpl:48 //line views/hypha.qtpl:47
streamnonExistentHyphaNotice(qw422016, h, u, lc) streamnonExistentHyphaNotice(qw422016, h, u, lc)
//line views/hypha.qtpl:48 //line views/hypha.qtpl:47
qt422016.ReleaseWriter(qw422016) qt422016.ReleaseWriter(qw422016)
//line views/hypha.qtpl:48 //line views/hypha.qtpl:47
} }
//line views/hypha.qtpl:48 //line views/hypha.qtpl:47
func nonExistentHyphaNotice(h hyphae.Hypha, u *user.User, lc *l18n.Localizer) string { func nonExistentHyphaNotice(h hyphae.Hypha, u *user.User, lc *l18n.Localizer) string {
//line views/hypha.qtpl:48 //line views/hypha.qtpl:47
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line views/hypha.qtpl:48 //line views/hypha.qtpl:47
writenonExistentHyphaNotice(qb422016, h, u, lc) writenonExistentHyphaNotice(qb422016, h, u, lc)
//line views/hypha.qtpl:48 //line views/hypha.qtpl:47
qs422016 := string(qb422016.B) qs422016 := string(qb422016.B)
//line views/hypha.qtpl:48 //line views/hypha.qtpl:47
qt422016.ReleaseByteBuffer(qb422016) qt422016.ReleaseByteBuffer(qb422016)
//line views/hypha.qtpl:48 //line views/hypha.qtpl:47
return qs422016 return qs422016
//line views/hypha.qtpl:48 //line views/hypha.qtpl:47
} }
//line views/hypha.qtpl:50 //line views/hypha.qtpl:49
func StreamNaviTitle(qw422016 *qt422016.Writer, h hyphae.Hypha) {
//line views/hypha.qtpl:50
qw422016.N().S(`
`)
//line views/hypha.qtpl:52
var (
prevAcc = "/hypha/"
parts = strings.Split(h.CanonicalName(), "/")
)
//line views/hypha.qtpl:56
qw422016.N().S(`
<h1 class="navi-title">
`)
//line views/hypha.qtpl:58
qw422016.N().S(`<a href="/hypha/`)
//line views/hypha.qtpl:59
qw422016.E().S(cfg.HomeHypha)
//line views/hypha.qtpl:59
qw422016.N().S(`">`)
//line views/hypha.qtpl:60
qw422016.N().S(cfg.NaviTitleIcon)
//line views/hypha.qtpl:60
qw422016.N().S(`<span aria-hidden="true" class="navi-title__colon">:</span></a>`)
//line views/hypha.qtpl:64
for i, part := range parts {
//line views/hypha.qtpl:65
if i > 0 {
//line views/hypha.qtpl:65
qw422016.N().S(`<span aria-hidden="true" class="navi-title__separator">/</span>`)
//line views/hypha.qtpl:67
}
//line views/hypha.qtpl:67
qw422016.N().S(`<a href="`)
//line views/hypha.qtpl:69
qw422016.E().S(prevAcc + part)
//line views/hypha.qtpl:69
qw422016.N().S(`" rel="`)
//line views/hypha.qtpl:69
if i == len(parts)-1 {
//line views/hypha.qtpl:69
qw422016.N().S(`bookmark`)
//line views/hypha.qtpl:69
} else {
//line views/hypha.qtpl:69
qw422016.N().S(`up`)
//line views/hypha.qtpl:69
}
//line views/hypha.qtpl:69
qw422016.N().S(`">`)
//line views/hypha.qtpl:70
qw422016.N().S(util.BeautifulName(part))
//line views/hypha.qtpl:70
qw422016.N().S(`</a>`)
//line views/hypha.qtpl:72
prevAcc += part + "/"
//line views/hypha.qtpl:73
}
//line views/hypha.qtpl:74
qw422016.N().S(`
</h1>
`)
//line views/hypha.qtpl:76
}
//line views/hypha.qtpl:76
func WriteNaviTitle(qq422016 qtio422016.Writer, h hyphae.Hypha) {
//line views/hypha.qtpl:76
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/hypha.qtpl:76
StreamNaviTitle(qw422016, h)
//line views/hypha.qtpl:76
qt422016.ReleaseWriter(qw422016)
//line views/hypha.qtpl:76
}
//line views/hypha.qtpl:76
func NaviTitle(h hyphae.Hypha) string {
//line views/hypha.qtpl:76
qb422016 := qt422016.AcquireByteBuffer()
//line views/hypha.qtpl:76
WriteNaviTitle(qb422016, h)
//line views/hypha.qtpl:76
qs422016 := string(qb422016.B)
//line views/hypha.qtpl:76
qt422016.ReleaseByteBuffer(qb422016)
//line views/hypha.qtpl:76
return qs422016
//line views/hypha.qtpl:76
}
//line views/hypha.qtpl:78
func StreamMediaRaw(qw422016 *qt422016.Writer, h *hyphae.MediaHypha) { func StreamMediaRaw(qw422016 *qt422016.Writer, h *hyphae.MediaHypha) {
//line views/hypha.qtpl:78 //line views/hypha.qtpl:49
StreamMedia(qw422016, h, l18n.New("en", "en")) StreamMedia(qw422016, h, l18n.New("en", "en"))
//line views/hypha.qtpl:78 //line views/hypha.qtpl:49
} }
//line views/hypha.qtpl:78 //line views/hypha.qtpl:49
func WriteMediaRaw(qq422016 qtio422016.Writer, h *hyphae.MediaHypha) { func WriteMediaRaw(qq422016 qtio422016.Writer, h *hyphae.MediaHypha) {
//line views/hypha.qtpl:78 //line views/hypha.qtpl:49
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line views/hypha.qtpl:78 //line views/hypha.qtpl:49
StreamMediaRaw(qw422016, h) StreamMediaRaw(qw422016, h)
//line views/hypha.qtpl:78 //line views/hypha.qtpl:49
qt422016.ReleaseWriter(qw422016) qt422016.ReleaseWriter(qw422016)
//line views/hypha.qtpl:78 //line views/hypha.qtpl:49
} }
//line views/hypha.qtpl:78 //line views/hypha.qtpl:49
func MediaRaw(h *hyphae.MediaHypha) string { func MediaRaw(h *hyphae.MediaHypha) string {
//line views/hypha.qtpl:78 //line views/hypha.qtpl:49
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line views/hypha.qtpl:78 //line views/hypha.qtpl:49
WriteMediaRaw(qb422016, h) WriteMediaRaw(qb422016, h)
//line views/hypha.qtpl:78 //line views/hypha.qtpl:49
qs422016 := string(qb422016.B) qs422016 := string(qb422016.B)
//line views/hypha.qtpl:78 //line views/hypha.qtpl:49
qt422016.ReleaseByteBuffer(qb422016) qt422016.ReleaseByteBuffer(qb422016)
//line views/hypha.qtpl:78 //line views/hypha.qtpl:49
return qs422016 return qs422016
//line views/hypha.qtpl:78 //line views/hypha.qtpl:49
} }
//line views/hypha.qtpl:80 //line views/hypha.qtpl:51
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:80 //line views/hypha.qtpl:51
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/hypha.qtpl:81 //line views/hypha.qtpl:52
switch filepath.Ext(h.MediaFilePath()) { switch filepath.Ext(h.MediaFilePath()) {
//line views/hypha.qtpl:83 //line views/hypha.qtpl:54
case ".jpg", ".gif", ".png", ".webp", ".svg", ".ico": case ".jpg", ".gif", ".png", ".webp", ".svg", ".ico":
//line views/hypha.qtpl:83 //line views/hypha.qtpl:54
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:85 //line views/hypha.qtpl:56
qw422016.N().S(h.CanonicalName()) qw422016.N().S(h.CanonicalName())
//line views/hypha.qtpl:85 //line views/hypha.qtpl:56
qw422016.N().S(`"><img src="/binary/`) qw422016.N().S(`"><img src="/binary/`)
//line views/hypha.qtpl:85 //line views/hypha.qtpl:56
qw422016.N().S(h.CanonicalName()) qw422016.N().S(h.CanonicalName())
//line views/hypha.qtpl:85 //line views/hypha.qtpl:56
qw422016.N().S(`"/></a> qw422016.N().S(`"/></a>
</div> </div>
`) `)
//line views/hypha.qtpl:88 //line views/hypha.qtpl:59
case ".ogg", ".webm", ".mp4": case ".ogg", ".webm", ".mp4":
//line views/hypha.qtpl:88 //line views/hypha.qtpl:59
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:91 //line views/hypha.qtpl:62
qw422016.N().S(h.CanonicalName()) qw422016.N().S(h.CanonicalName())
//line views/hypha.qtpl:91 //line views/hypha.qtpl:62
qw422016.N().S(`"/> qw422016.N().S(`"/>
<p>`) <p>`)
//line views/hypha.qtpl:92 //line views/hypha.qtpl:63
qw422016.E().S(lc.Get("ui.media_novideo")) qw422016.E().S(lc.Get("ui.media_novideo"))
//line views/hypha.qtpl:92 //line views/hypha.qtpl:63
qw422016.N().S(` <a href="/binary/`) qw422016.N().S(` <a href="/binary/`)
//line views/hypha.qtpl:92 //line views/hypha.qtpl:63
qw422016.N().S(h.CanonicalName()) qw422016.N().S(h.CanonicalName())
//line views/hypha.qtpl:92 //line views/hypha.qtpl:63
qw422016.N().S(`">`) qw422016.N().S(`">`)
//line views/hypha.qtpl:92 //line views/hypha.qtpl:63
qw422016.E().S(lc.Get("ui.media_novideo_link")) qw422016.E().S(lc.Get("ui.media_novideo_link"))
//line views/hypha.qtpl:92 //line views/hypha.qtpl:63
qw422016.N().S(`</a></p> qw422016.N().S(`</a></p>
</video> </video>
</div> </div>
`) `)
//line views/hypha.qtpl:96 //line views/hypha.qtpl:67
case ".mp3": case ".mp3":
//line views/hypha.qtpl:96 //line views/hypha.qtpl:67
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:99 //line views/hypha.qtpl:70
qw422016.N().S(h.CanonicalName()) qw422016.N().S(h.CanonicalName())
//line views/hypha.qtpl:99 //line views/hypha.qtpl:70
qw422016.N().S(`"/> qw422016.N().S(`"/>
<p>`) <p>`)
//line views/hypha.qtpl:100 //line views/hypha.qtpl:71
qw422016.E().S(lc.Get("ui.media_noaudio")) qw422016.E().S(lc.Get("ui.media_noaudio"))
//line views/hypha.qtpl:100 //line views/hypha.qtpl:71
qw422016.N().S(` <a href="/binary/`) qw422016.N().S(` <a href="/binary/`)
//line views/hypha.qtpl:100 //line views/hypha.qtpl:71
qw422016.N().S(h.CanonicalName()) qw422016.N().S(h.CanonicalName())
//line views/hypha.qtpl:100 //line views/hypha.qtpl:71
qw422016.N().S(`">`) qw422016.N().S(`">`)
//line views/hypha.qtpl:100 //line views/hypha.qtpl:71
qw422016.E().S(lc.Get("ui.media_noaudio_link")) qw422016.E().S(lc.Get("ui.media_noaudio_link"))
//line views/hypha.qtpl:100 //line views/hypha.qtpl:71
qw422016.N().S(`</a></p> qw422016.N().S(`</a></p>
</audio> </audio>
</div> </div>
`) `)
//line views/hypha.qtpl:104 //line views/hypha.qtpl:75
default: default:
//line views/hypha.qtpl:104 //line views/hypha.qtpl:75
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:106 //line views/hypha.qtpl:77
qw422016.N().S(h.CanonicalName()) qw422016.N().S(h.CanonicalName())
//line views/hypha.qtpl:106 //line views/hypha.qtpl:77
qw422016.N().S(`">`) qw422016.N().S(`">`)
//line views/hypha.qtpl:106 //line views/hypha.qtpl:77
qw422016.E().S(lc.Get("ui.media_download")) qw422016.E().S(lc.Get("ui.media_download"))
//line views/hypha.qtpl:106 //line views/hypha.qtpl:77
qw422016.N().S(`</a></p> qw422016.N().S(`</a></p>
</div> </div>
`) `)
//line views/hypha.qtpl:108 //line views/hypha.qtpl:79
} }
//line views/hypha.qtpl:108 //line views/hypha.qtpl:79
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/hypha.qtpl:109 //line views/hypha.qtpl:80
} }
//line views/hypha.qtpl:109 //line views/hypha.qtpl:80
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:109 //line views/hypha.qtpl:80
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line views/hypha.qtpl:109 //line views/hypha.qtpl:80
StreamMedia(qw422016, h, lc) StreamMedia(qw422016, h, lc)
//line views/hypha.qtpl:109 //line views/hypha.qtpl:80
qt422016.ReleaseWriter(qw422016) qt422016.ReleaseWriter(qw422016)
//line views/hypha.qtpl:109 //line views/hypha.qtpl:80
} }
//line views/hypha.qtpl:109 //line views/hypha.qtpl:80
func Media(h *hyphae.MediaHypha, lc *l18n.Localizer) string { func Media(h *hyphae.MediaHypha, lc *l18n.Localizer) string {
//line views/hypha.qtpl:109 //line views/hypha.qtpl:80
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line views/hypha.qtpl:109 //line views/hypha.qtpl:80
WriteMedia(qb422016, h, lc) WriteMedia(qb422016, h, lc)
//line views/hypha.qtpl:109 //line views/hypha.qtpl:80
qs422016 := string(qb422016.B) qs422016 := string(qb422016.B)
//line views/hypha.qtpl:109 //line views/hypha.qtpl:80
qt422016.ReleaseByteBuffer(qb422016) qt422016.ReleaseByteBuffer(qb422016)
//line views/hypha.qtpl:109 //line views/hypha.qtpl:80
return qs422016 return qs422016
//line views/hypha.qtpl:109 //line views/hypha.qtpl:80
} }

View File

@ -5,6 +5,7 @@
{% import "github.com/bouncepaw/mycorrhiza/cfg" %} {% import "github.com/bouncepaw/mycorrhiza/cfg" %}
{% import "github.com/bouncepaw/mycorrhiza/hyphae" %} {% import "github.com/bouncepaw/mycorrhiza/hyphae" %}
{% import "github.com/bouncepaw/mycorrhiza/hypview" %}
{% import "github.com/bouncepaw/mycorrhiza/categories" %} {% import "github.com/bouncepaw/mycorrhiza/categories" %}
{% import "github.com/bouncepaw/mycorrhiza/l18n" %} {% import "github.com/bouncepaw/mycorrhiza/l18n" %}
{% import "github.com/bouncepaw/mycorrhiza/mimetype" %} {% import "github.com/bouncepaw/mycorrhiza/mimetype" %}
@ -109,7 +110,7 @@ If you rename .prevnext, change the docs too.
{% endif %} {% endif %}
{% endif %} {% endif %}
{%s= NaviTitle(h) %} {%s= hypview.NaviTitle(meta, h.CanonicalName()) %}
{% switch h.(type) %} {% switch h.(type) %}
{% case *hyphae.EmptyHypha %} {% case *hyphae.EmptyHypha %}
{%= nonExistentHyphaNotice(h, meta.U, meta.Lc) %} {%= nonExistentHyphaNotice(h, meta.U, meta.Lc) %}
@ -135,11 +136,11 @@ If you rename .prevnext, change the docs too.
{%= viewScripts() %} {%= viewScripts() %}
{% endfunc %} {% endfunc %}
{% func Revision(rq *http.Request, lc *l18n.Localizer, h hyphae.Hypha, contents, revHash string) %} {% func Revision(meta viewutil.Meta, h hyphae.Hypha, contents, revHash string) %}
<main class="main-width"> <main class="main-width">
<section> <section>
<p>{%s lc.Get("ui.revision_warning") %} <a href="/rev-text/{%s revHash %}/{%s h.CanonicalName() %}">{%s lc.Get("ui.revision_link") %}</a></p> <p>{%s meta.Lc.Get("ui.revision_warning") %} <a href="/rev-text/{%s revHash %}/{%s h.CanonicalName() %}">{%s meta.Lc.Get("ui.revision_link") %}</a></p>
{%s= NaviTitle(h) %} {%s= hypview.NaviTitle(meta, h.CanonicalName()) %}
{%s= contents %} {%s= contents %}
</section> </section>
</main> </main>

View File

@ -23,613 +23,616 @@ import "github.com/bouncepaw/mycorrhiza/cfg"
import "github.com/bouncepaw/mycorrhiza/hyphae" import "github.com/bouncepaw/mycorrhiza/hyphae"
//line views/readers.qtpl:8 //line views/readers.qtpl:8
import "github.com/bouncepaw/mycorrhiza/categories" import "github.com/bouncepaw/mycorrhiza/hypview"
//line views/readers.qtpl:9 //line views/readers.qtpl:9
import "github.com/bouncepaw/mycorrhiza/l18n" import "github.com/bouncepaw/mycorrhiza/categories"
//line views/readers.qtpl:10 //line views/readers.qtpl:10
import "github.com/bouncepaw/mycorrhiza/mimetype" import "github.com/bouncepaw/mycorrhiza/l18n"
//line views/readers.qtpl:11 //line views/readers.qtpl:11
import "github.com/bouncepaw/mycorrhiza/tree" import "github.com/bouncepaw/mycorrhiza/mimetype"
//line views/readers.qtpl:12 //line views/readers.qtpl:12
import "github.com/bouncepaw/mycorrhiza/user" import "github.com/bouncepaw/mycorrhiza/tree"
//line views/readers.qtpl:13 //line views/readers.qtpl:13
import "github.com/bouncepaw/mycorrhiza/util" import "github.com/bouncepaw/mycorrhiza/user"
//line views/readers.qtpl:14 //line views/readers.qtpl:14
import "github.com/bouncepaw/mycorrhiza/util"
//line views/readers.qtpl:15
import "github.com/bouncepaw/mycorrhiza/viewutil" import "github.com/bouncepaw/mycorrhiza/viewutil"
//line views/readers.qtpl:16 //line views/readers.qtpl:17
import ( import (
qtio422016 "io" qtio422016 "io"
qt422016 "github.com/valyala/quicktemplate" qt422016 "github.com/valyala/quicktemplate"
) )
//line views/readers.qtpl:16 //line views/readers.qtpl:17
var ( var (
_ = qtio422016.Copy _ = qtio422016.Copy
_ = qt422016.AcquireByteBuffer _ = qt422016.AcquireByteBuffer
) )
//line views/readers.qtpl:16 //line views/readers.qtpl:17
func StreamMediaMenu(qw422016 *qt422016.Writer, rq *http.Request, h hyphae.Hypha, u *user.User) { func StreamMediaMenu(qw422016 *qt422016.Writer, rq *http.Request, h hyphae.Hypha, u *user.User) {
//line views/readers.qtpl:16 //line views/readers.qtpl:17
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/readers.qtpl:18 //line views/readers.qtpl:19
lc := l18n.FromRequest(rq) lc := l18n.FromRequest(rq)
//line views/readers.qtpl:19 //line views/readers.qtpl:20
qw422016.N().S(` qw422016.N().S(`
<main class="main-width media-tab"> <main class="main-width media-tab">
<h1>`) <h1>`)
//line views/readers.qtpl:21 //line views/readers.qtpl:22
qw422016.N().S(lc.Get("ui.media_title", &l18n.Replacements{"name": beautifulLink(h.CanonicalName())})) qw422016.N().S(lc.Get("ui.media_title", &l18n.Replacements{"name": beautifulLink(h.CanonicalName())}))
//line views/readers.qtpl:21 //line views/readers.qtpl:22
qw422016.N().S(`</h1> qw422016.N().S(`</h1>
`) `)
//line views/readers.qtpl:22 //line views/readers.qtpl:23
switch h.(type) { switch h.(type) {
//line views/readers.qtpl:23 //line views/readers.qtpl:24
case *hyphae.MediaHypha: case *hyphae.MediaHypha:
//line views/readers.qtpl:23 //line views/readers.qtpl:24
qw422016.N().S(` qw422016.N().S(`
<p class="explanation">`) <p class="explanation">`)
//line views/readers.qtpl:24 //line views/readers.qtpl:25
qw422016.E().S(lc.Get("ui.media_tip")) qw422016.E().S(lc.Get("ui.media_tip"))
//line views/readers.qtpl:24 //line views/readers.qtpl:25
qw422016.N().S(` <a href="/help/en/media" class="shy-link">`) qw422016.N().S(` <a href="/help/en/media" class="shy-link">`)
//line views/readers.qtpl:24 //line views/readers.qtpl:25
qw422016.E().S(lc.Get("ui.media_what_is")) qw422016.E().S(lc.Get("ui.media_what_is"))
//line views/readers.qtpl:24 //line views/readers.qtpl:25
qw422016.N().S(`</a></p> qw422016.N().S(`</a></p>
`) `)
//line views/readers.qtpl:25 //line views/readers.qtpl:26
default: default:
//line views/readers.qtpl:25 //line views/readers.qtpl:26
qw422016.N().S(` qw422016.N().S(`
<p class="explanation">`) <p class="explanation">`)
//line views/readers.qtpl:26 //line views/readers.qtpl:27
qw422016.E().S(lc.Get("ui.media_empty")) qw422016.E().S(lc.Get("ui.media_empty"))
//line views/readers.qtpl:26 //line views/readers.qtpl:27
qw422016.N().S(` <a href="/help/en/media" class="shy-link">`) qw422016.N().S(` <a href="/help/en/media" class="shy-link">`)
//line views/readers.qtpl:26 //line views/readers.qtpl:27
qw422016.E().S(lc.Get("ui.media_what_is")) qw422016.E().S(lc.Get("ui.media_what_is"))
//line views/readers.qtpl:26 //line views/readers.qtpl:27
qw422016.N().S(`</a></p> qw422016.N().S(`</a></p>
`) `)
//line views/readers.qtpl:27 //line views/readers.qtpl:28
} }
//line views/readers.qtpl:27 //line views/readers.qtpl:28
qw422016.N().S(` qw422016.N().S(`
<section class="amnt-grid"> <section class="amnt-grid">
`) `)
//line views/readers.qtpl:30 //line views/readers.qtpl:31
switch h := h.(type) { switch h := h.(type) {
//line views/readers.qtpl:31 //line views/readers.qtpl:32
case *hyphae.MediaHypha: case *hyphae.MediaHypha:
//line views/readers.qtpl:31 //line views/readers.qtpl:32
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/readers.qtpl:33 //line views/readers.qtpl:34
mime := mimetype.FromExtension(path.Ext(h.MediaFilePath())) mime := mimetype.FromExtension(path.Ext(h.MediaFilePath()))
fileinfo, err := os.Stat(h.MediaFilePath()) fileinfo, err := os.Stat(h.MediaFilePath())
//line views/readers.qtpl:34 //line views/readers.qtpl:35
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/readers.qtpl:35 //line views/readers.qtpl:36
if err == nil { if err == nil {
//line views/readers.qtpl:35 //line views/readers.qtpl:36
qw422016.N().S(` qw422016.N().S(`
<fieldset class="amnt-menu-block"> <fieldset class="amnt-menu-block">
<legend class="modal__title modal__title_small">`) <legend class="modal__title modal__title_small">`)
//line views/readers.qtpl:37 //line views/readers.qtpl:38
qw422016.E().S(lc.Get("ui.media_stat")) qw422016.E().S(lc.Get("ui.media_stat"))
//line views/readers.qtpl:37 //line views/readers.qtpl:38
qw422016.N().S(`</legend> qw422016.N().S(`</legend>
<p class="modal__confirmation-msg"><b>`) <p class="modal__confirmation-msg"><b>`)
//line views/readers.qtpl:38 //line views/readers.qtpl:39
qw422016.E().S(lc.Get("ui.media_stat_size")) qw422016.E().S(lc.Get("ui.media_stat_size"))
//line views/readers.qtpl:38 //line views/readers.qtpl:39
qw422016.N().S(`</b> `) qw422016.N().S(`</b> `)
//line views/readers.qtpl:38 //line views/readers.qtpl:39
qw422016.E().S(lc.GetPlural64("ui.media_size_value", fileinfo.Size())) qw422016.E().S(lc.GetPlural64("ui.media_size_value", fileinfo.Size()))
//line views/readers.qtpl:38 //line views/readers.qtpl:39
qw422016.N().S(`</p> qw422016.N().S(`</p>
<p><b>`) <p><b>`)
//line views/readers.qtpl:39 //line views/readers.qtpl:40
qw422016.E().S(lc.Get("ui.media_stat_mime")) qw422016.E().S(lc.Get("ui.media_stat_mime"))
//line views/readers.qtpl:39 //line views/readers.qtpl:40
qw422016.N().S(`</b> `) qw422016.N().S(`</b> `)
//line views/readers.qtpl:39 //line views/readers.qtpl:40
qw422016.E().S(mime) qw422016.E().S(mime)
//line views/readers.qtpl:39 //line views/readers.qtpl:40
qw422016.N().S(`</p> qw422016.N().S(`</p>
</fieldset> </fieldset>
`) `)
//line views/readers.qtpl:41 //line views/readers.qtpl:42
} }
//line views/readers.qtpl:41 //line views/readers.qtpl:42
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/readers.qtpl:43 //line views/readers.qtpl:44
if strings.HasPrefix(mime, "image/") { if strings.HasPrefix(mime, "image/") {
//line views/readers.qtpl:43 //line views/readers.qtpl:44
qw422016.N().S(` qw422016.N().S(`
<fieldset class="amnt-menu-block"> <fieldset class="amnt-menu-block">
<legend class="modal__title modal__title_small">`) <legend class="modal__title modal__title_small">`)
//line views/readers.qtpl:45 //line views/readers.qtpl:46
qw422016.E().S(lc.Get("ui.media_include")) qw422016.E().S(lc.Get("ui.media_include"))
//line views/readers.qtpl:45 //line views/readers.qtpl:46
qw422016.N().S(`</legend> qw422016.N().S(`</legend>
<p class="modal__confirmation-msg">`) <p class="modal__confirmation-msg">`)
//line views/readers.qtpl:46 //line views/readers.qtpl:47
qw422016.E().S(lc.Get("ui.media_include_tip")) qw422016.E().S(lc.Get("ui.media_include_tip"))
//line views/readers.qtpl:46 //line views/readers.qtpl:47
qw422016.N().S(`</p> qw422016.N().S(`</p>
<pre class="codeblock"><code>img { `) <pre class="codeblock"><code>img { `)
//line views/readers.qtpl:47 //line views/readers.qtpl:48
qw422016.E().S(h.CanonicalName()) qw422016.E().S(h.CanonicalName())
//line views/readers.qtpl:47 //line views/readers.qtpl:48
qw422016.N().S(` }</code></pre> qw422016.N().S(` }</code></pre>
</fieldset> </fieldset>
`) `)
//line views/readers.qtpl:49 //line views/readers.qtpl:50
} }
//line views/readers.qtpl:49 //line views/readers.qtpl:50
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/readers.qtpl:50 //line views/readers.qtpl:51
} }
//line views/readers.qtpl:50 //line views/readers.qtpl:51
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/readers.qtpl:52 //line views/readers.qtpl:53
if u.CanProceed("upload-binary") { if u.CanProceed("upload-binary") {
//line views/readers.qtpl:52 //line views/readers.qtpl:53
qw422016.N().S(` qw422016.N().S(`
<form action="/upload-binary/`) <form action="/upload-binary/`)
//line views/readers.qtpl:53 //line views/readers.qtpl:54
qw422016.E().S(h.CanonicalName()) qw422016.E().S(h.CanonicalName())
//line views/readers.qtpl:53 //line views/readers.qtpl:54
qw422016.N().S(`" qw422016.N().S(`"
method="post" enctype="multipart/form-data" method="post" enctype="multipart/form-data"
class="upload-binary modal amnt-menu-block"> class="upload-binary modal amnt-menu-block">
<fieldset class="modal__fieldset"> <fieldset class="modal__fieldset">
<legend class="modal__title modal__title_small">`) <legend class="modal__title modal__title_small">`)
//line views/readers.qtpl:57 //line views/readers.qtpl:58
qw422016.E().S(lc.Get("ui.media_new")) qw422016.E().S(lc.Get("ui.media_new"))
//line views/readers.qtpl:57 //line views/readers.qtpl:58
qw422016.N().S(`</legend> qw422016.N().S(`</legend>
<p class="modal__confirmation-msg">`) <p class="modal__confirmation-msg">`)
//line views/readers.qtpl:58 //line views/readers.qtpl:59
qw422016.E().S(lc.Get("ui.media_new_tip")) qw422016.E().S(lc.Get("ui.media_new_tip"))
//line views/readers.qtpl:58 //line views/readers.qtpl:59
qw422016.N().S(`</p> qw422016.N().S(`</p>
<label for="upload-binary__input"></label> <label for="upload-binary__input"></label>
<input type="file" id="upload-binary__input" name="binary"> <input type="file" id="upload-binary__input" name="binary">
<button type="submit" class="btn stick-to-bottom" value="Upload">`) <button type="submit" class="btn stick-to-bottom" value="Upload">`)
//line views/readers.qtpl:62 //line views/readers.qtpl:63
qw422016.E().S(lc.Get("ui.media_upload")) qw422016.E().S(lc.Get("ui.media_upload"))
//line views/readers.qtpl:62 //line views/readers.qtpl:63
qw422016.N().S(`</button> qw422016.N().S(`</button>
</fieldset> </fieldset>
</form> </form>
`) `)
//line views/readers.qtpl:65 //line views/readers.qtpl:66
} }
//line views/readers.qtpl:65 //line views/readers.qtpl:66
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/readers.qtpl:68 //line views/readers.qtpl:69
switch h := h.(type) { switch h := h.(type) {
//line views/readers.qtpl:69 //line views/readers.qtpl:70
case *hyphae.MediaHypha: case *hyphae.MediaHypha:
//line views/readers.qtpl:69 //line views/readers.qtpl:70
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/readers.qtpl:70 //line views/readers.qtpl:71
if u.CanProceed("remove-media") { if u.CanProceed("remove-media") {
//line views/readers.qtpl:70 //line views/readers.qtpl:71
qw422016.N().S(` qw422016.N().S(`
<form action="/remove-media/`) <form action="/remove-media/`)
//line views/readers.qtpl:71 //line views/readers.qtpl:72
qw422016.E().S(h.CanonicalName()) qw422016.E().S(h.CanonicalName())
//line views/readers.qtpl:71 //line views/readers.qtpl:72
qw422016.N().S(`" method="post" class="modal amnt-menu-block" method="POST"> qw422016.N().S(`" method="post" class="modal amnt-menu-block" method="POST">
<fieldset class="modal__fieldset"> <fieldset class="modal__fieldset">
<legend class="modal__title modal__title_small">`) <legend class="modal__title modal__title_small">`)
//line views/readers.qtpl:73 //line views/readers.qtpl:74
qw422016.E().S(lc.Get("ui.media_remove")) qw422016.E().S(lc.Get("ui.media_remove"))
//line views/readers.qtpl:73 //line views/readers.qtpl:74
qw422016.N().S(`</legend> qw422016.N().S(`</legend>
<p class="modal__confirmation-msg">`) <p class="modal__confirmation-msg">`)
//line views/readers.qtpl:74 //line views/readers.qtpl:75
qw422016.E().S(lc.Get("ui.media_remove_tip")) qw422016.E().S(lc.Get("ui.media_remove_tip"))
//line views/readers.qtpl:74 //line views/readers.qtpl:75
qw422016.N().S(`</p> qw422016.N().S(`</p>
<button type="submit" class="btn" value="Remove media">`) <button type="submit" class="btn" value="Remove media">`)
//line views/readers.qtpl:75 //line views/readers.qtpl:76
qw422016.E().S(lc.Get("ui.media_remove_button")) qw422016.E().S(lc.Get("ui.media_remove_button"))
//line views/readers.qtpl:75 //line views/readers.qtpl:76
qw422016.N().S(`</button> qw422016.N().S(`</button>
</fieldset> </fieldset>
</form> </form>
`) `)
//line views/readers.qtpl:78 //line views/readers.qtpl:79
} }
//line views/readers.qtpl:78 //line views/readers.qtpl:79
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/readers.qtpl:79 //line views/readers.qtpl:80
} }
//line views/readers.qtpl:79 //line views/readers.qtpl:80
qw422016.N().S(` qw422016.N().S(`
</section> </section>
</main> </main>
`) `)
//line views/readers.qtpl:83 //line views/readers.qtpl:84
} }
//line views/readers.qtpl:83 //line views/readers.qtpl:84
func WriteMediaMenu(qq422016 qtio422016.Writer, rq *http.Request, h hyphae.Hypha, u *user.User) { func WriteMediaMenu(qq422016 qtio422016.Writer, rq *http.Request, h hyphae.Hypha, u *user.User) {
//line views/readers.qtpl:83 //line views/readers.qtpl:84
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line views/readers.qtpl:83 //line views/readers.qtpl:84
StreamMediaMenu(qw422016, rq, h, u) StreamMediaMenu(qw422016, rq, h, u)
//line views/readers.qtpl:83 //line views/readers.qtpl:84
qt422016.ReleaseWriter(qw422016) qt422016.ReleaseWriter(qw422016)
//line views/readers.qtpl:83 //line views/readers.qtpl:84
} }
//line views/readers.qtpl:83 //line views/readers.qtpl:84
func MediaMenu(rq *http.Request, h hyphae.Hypha, u *user.User) string { func MediaMenu(rq *http.Request, h hyphae.Hypha, u *user.User) string {
//line views/readers.qtpl:83 //line views/readers.qtpl:84
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line views/readers.qtpl:83 //line views/readers.qtpl:84
WriteMediaMenu(qb422016, rq, h, u) WriteMediaMenu(qb422016, rq, h, u)
//line views/readers.qtpl:83 //line views/readers.qtpl:84
qs422016 := string(qb422016.B) qs422016 := string(qb422016.B)
//line views/readers.qtpl:83 //line views/readers.qtpl:84
qt422016.ReleaseByteBuffer(qb422016) qt422016.ReleaseByteBuffer(qb422016)
//line views/readers.qtpl:83 //line views/readers.qtpl:84
return qs422016 return qs422016
//line views/readers.qtpl:83 //line views/readers.qtpl:84
} }
// If `contents` == "", a helpful message is shown instead. // If `contents` == "", a helpful message is shown instead.
// //
// If you rename .prevnext, change the docs too. // If you rename .prevnext, change the docs too.
//line views/readers.qtpl:88 //line views/readers.qtpl:89
func StreamHypha(qw422016 *qt422016.Writer, meta viewutil.Meta, h hyphae.Hypha, contents string) { func StreamHypha(qw422016 *qt422016.Writer, meta viewutil.Meta, h hyphae.Hypha, contents string) {
//line views/readers.qtpl:88 //line views/readers.qtpl:89
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/readers.qtpl:90 //line views/readers.qtpl:91
siblings, subhyphae, prevHyphaName, nextHyphaName := tree.Tree(h.CanonicalName()) siblings, subhyphae, prevHyphaName, nextHyphaName := tree.Tree(h.CanonicalName())
lc := meta.Lc lc := meta.Lc
//line views/readers.qtpl:92 //line views/readers.qtpl:93
qw422016.N().S(` qw422016.N().S(`
<main class="main-width"> <main class="main-width">
<section id="hypha"> <section id="hypha">
`) `)
//line views/readers.qtpl:95 //line views/readers.qtpl:96
if meta.U.CanProceed("edit") { if meta.U.CanProceed("edit") {
//line views/readers.qtpl:95 //line views/readers.qtpl:96
qw422016.N().S(` qw422016.N().S(`
<div class="btn btn_navititle"> <div class="btn btn_navititle">
<a class="btn__link_navititle" href="/edit/`) <a class="btn__link_navititle" href="/edit/`)
//line views/readers.qtpl:97 //line views/readers.qtpl:98
qw422016.E().S(h.CanonicalName()) qw422016.E().S(h.CanonicalName())
//line views/readers.qtpl:97 //line views/readers.qtpl:98
qw422016.N().S(`">`) qw422016.N().S(`">`)
//line views/readers.qtpl:97 //line views/readers.qtpl:98
qw422016.E().S(lc.Get("ui.edit_link")) qw422016.E().S(lc.Get("ui.edit_link"))
//line views/readers.qtpl:97 //line views/readers.qtpl:98
qw422016.N().S(`</a> qw422016.N().S(`</a>
</div> </div>
`) `)
//line views/readers.qtpl:99 //line views/readers.qtpl:100
} }
//line views/readers.qtpl:99 //line views/readers.qtpl:100
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/readers.qtpl:101 //line views/readers.qtpl:102
if cfg.UseAuth && util.IsProfileName(h.CanonicalName()) && meta.U.Name == strings.TrimPrefix(h.CanonicalName(), cfg.UserHypha+"/") { if cfg.UseAuth && util.IsProfileName(h.CanonicalName()) && meta.U.Name == strings.TrimPrefix(h.CanonicalName(), cfg.UserHypha+"/") {
//line views/readers.qtpl:101 //line views/readers.qtpl:102
qw422016.N().S(` qw422016.N().S(`
<div class="btn btn_navititle"> <div class="btn btn_navititle">
<a class="btn__link_navititle" href="/logout">`) <a class="btn__link_navititle" href="/logout">`)
//line views/readers.qtpl:103 //line views/readers.qtpl:104
qw422016.E().S(lc.Get("ui.logout_link")) qw422016.E().S(lc.Get("ui.logout_link"))
//line views/readers.qtpl:103 //line views/readers.qtpl:104
qw422016.N().S(`</a> qw422016.N().S(`</a>
</div> </div>
`) `)
//line views/readers.qtpl:105 //line views/readers.qtpl:106
if meta.U.Group == "admin" { if meta.U.Group == "admin" {
//line views/readers.qtpl:105 //line views/readers.qtpl:106
qw422016.N().S(` qw422016.N().S(`
<div class="btn btn_navititle"> <div class="btn btn_navititle">
<a class="btn__link_navititle" href="/admin">`) <a class="btn__link_navititle" href="/admin">`)
//line views/readers.qtpl:107 //line views/readers.qtpl:108
qw422016.E().S(lc.Get("ui.admin_panel")) qw422016.E().S(lc.Get("ui.admin_panel"))
//line views/readers.qtpl:107 //line views/readers.qtpl:108
qw422016.N().S(`<a> qw422016.N().S(`<a>
</div> </div>
`) `)
//line views/readers.qtpl:109 //line views/readers.qtpl:110
} }
//line views/readers.qtpl:109 //line views/readers.qtpl:110
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/readers.qtpl:110 //line views/readers.qtpl:111
} }
//line views/readers.qtpl:110 //line views/readers.qtpl:111
qw422016.N().S(` qw422016.N().S(`
`)
//line views/readers.qtpl:112
qw422016.N().S(NaviTitle(h))
//line views/readers.qtpl:112
qw422016.N().S(`
`) `)
//line views/readers.qtpl:113 //line views/readers.qtpl:113
qw422016.N().S(hypview.NaviTitle(meta, h.CanonicalName()))
//line views/readers.qtpl:113
qw422016.N().S(`
`)
//line views/readers.qtpl:114
switch h.(type) { switch h.(type) {
//line views/readers.qtpl:114 //line views/readers.qtpl:115
case *hyphae.EmptyHypha: case *hyphae.EmptyHypha:
//line views/readers.qtpl:114 //line views/readers.qtpl:115
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/readers.qtpl:115 //line views/readers.qtpl:116
streamnonExistentHyphaNotice(qw422016, h, meta.U, meta.Lc) streamnonExistentHyphaNotice(qw422016, h, meta.U, meta.Lc)
//line views/readers.qtpl:115 //line views/readers.qtpl:116
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/readers.qtpl:116 //line views/readers.qtpl:117
default: default:
//line views/readers.qtpl:116 //line views/readers.qtpl:117
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/readers.qtpl:117 //line views/readers.qtpl:118
qw422016.N().S(contents) qw422016.N().S(contents)
//line views/readers.qtpl:117 //line views/readers.qtpl:118
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/readers.qtpl:118 //line views/readers.qtpl:119
} }
//line views/readers.qtpl:118 //line views/readers.qtpl:119
qw422016.N().S(` qw422016.N().S(`
</section> </section>
<section class="prevnext"> <section class="prevnext">
`) `)
//line views/readers.qtpl:121 //line views/readers.qtpl:122
if prevHyphaName != "" { if prevHyphaName != "" {
//line views/readers.qtpl:121 //line views/readers.qtpl:122
qw422016.N().S(` qw422016.N().S(`
<a class="prevnext__el prevnext__prev" href="/hypha/`) <a class="prevnext__el prevnext__prev" href="/hypha/`)
//line views/readers.qtpl:122 //line views/readers.qtpl:123
qw422016.E().S(prevHyphaName) qw422016.E().S(prevHyphaName)
//line views/readers.qtpl:122 //line views/readers.qtpl:123
qw422016.N().S(`" rel="prev">← `) qw422016.N().S(`" rel="prev">← `)
//line views/readers.qtpl:122 //line views/readers.qtpl:123
qw422016.E().S(util.BeautifulName(path.Base(prevHyphaName))) qw422016.E().S(util.BeautifulName(path.Base(prevHyphaName)))
//line views/readers.qtpl:122 //line views/readers.qtpl:123
qw422016.N().S(`</a> qw422016.N().S(`</a>
`) `)
//line views/readers.qtpl:123 //line views/readers.qtpl:124
} }
//line views/readers.qtpl:123 //line views/readers.qtpl:124
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/readers.qtpl:124 //line views/readers.qtpl:125
if nextHyphaName != "" { if nextHyphaName != "" {
//line views/readers.qtpl:124 //line views/readers.qtpl:125
qw422016.N().S(` qw422016.N().S(`
<a class="prevnext__el prevnext__next" href="/hypha/`) <a class="prevnext__el prevnext__next" href="/hypha/`)
//line views/readers.qtpl:125 //line views/readers.qtpl:126
qw422016.E().S(nextHyphaName) qw422016.E().S(nextHyphaName)
//line views/readers.qtpl:125 //line views/readers.qtpl:126
qw422016.N().S(`" rel="next">`) qw422016.N().S(`" rel="next">`)
//line views/readers.qtpl:125 //line views/readers.qtpl:126
qw422016.E().S(util.BeautifulName(path.Base(nextHyphaName))) qw422016.E().S(util.BeautifulName(path.Base(nextHyphaName)))
//line views/readers.qtpl:125 //line views/readers.qtpl:126
qw422016.N().S(` </a> qw422016.N().S(` </a>
`) `)
//line views/readers.qtpl:126 //line views/readers.qtpl:127
} }
//line views/readers.qtpl:126 //line views/readers.qtpl:127
qw422016.N().S(` qw422016.N().S(`
</section> </section>
`) `)
//line views/readers.qtpl:128 //line views/readers.qtpl:129
StreamSubhyphae(qw422016, subhyphae, meta.Lc) StreamSubhyphae(qw422016, subhyphae, meta.Lc)
//line views/readers.qtpl:128 //line views/readers.qtpl:129
qw422016.N().S(` qw422016.N().S(`
<section id="hypha-bottom"> <section id="hypha-bottom">
`) `)
//line views/readers.qtpl:130 //line views/readers.qtpl:131
streamhyphaInfo(qw422016, meta, h) streamhyphaInfo(qw422016, meta, h)
//line views/readers.qtpl:130 //line views/readers.qtpl:131
qw422016.N().S(` qw422016.N().S(`
</section> </section>
</main> </main>
`) `)
//line views/readers.qtpl:133 //line views/readers.qtpl:134
qw422016.N().S(categories.CategoryCard(meta, h.CanonicalName())) qw422016.N().S(categories.CategoryCard(meta, h.CanonicalName()))
//line views/readers.qtpl:133 //line views/readers.qtpl:134
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/readers.qtpl:134 //line views/readers.qtpl:135
streamsiblingHyphae(qw422016, siblings, meta.Lc) streamsiblingHyphae(qw422016, siblings, meta.Lc)
//line views/readers.qtpl:134 //line views/readers.qtpl:135
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/readers.qtpl:135 //line views/readers.qtpl:136
streamviewScripts(qw422016) streamviewScripts(qw422016)
//line views/readers.qtpl:135 //line views/readers.qtpl:136
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/readers.qtpl:136 //line views/readers.qtpl:137
} }
//line views/readers.qtpl:136 //line views/readers.qtpl:137
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:136 //line views/readers.qtpl:137
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line views/readers.qtpl:136 //line views/readers.qtpl:137
StreamHypha(qw422016, meta, h, contents) StreamHypha(qw422016, meta, h, contents)
//line views/readers.qtpl:136 //line views/readers.qtpl:137
qt422016.ReleaseWriter(qw422016) qt422016.ReleaseWriter(qw422016)
//line views/readers.qtpl:136 //line views/readers.qtpl:137
} }
//line views/readers.qtpl:136 //line views/readers.qtpl:137
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:136 //line views/readers.qtpl:137
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line views/readers.qtpl:136 //line views/readers.qtpl:137
WriteHypha(qb422016, meta, h, contents) WriteHypha(qb422016, meta, h, contents)
//line views/readers.qtpl:136 //line views/readers.qtpl:137
qs422016 := string(qb422016.B) qs422016 := string(qb422016.B)
//line views/readers.qtpl:136 //line views/readers.qtpl:137
qt422016.ReleaseByteBuffer(qb422016) qt422016.ReleaseByteBuffer(qb422016)
//line views/readers.qtpl:136 //line views/readers.qtpl:137
return qs422016 return qs422016
//line views/readers.qtpl:136 //line views/readers.qtpl:137
} }
//line views/readers.qtpl:138 //line views/readers.qtpl:139
func StreamRevision(qw422016 *qt422016.Writer, rq *http.Request, lc *l18n.Localizer, h hyphae.Hypha, contents, revHash string) { func StreamRevision(qw422016 *qt422016.Writer, meta viewutil.Meta, h hyphae.Hypha, contents, revHash string) {
//line views/readers.qtpl:138 //line views/readers.qtpl:139
qw422016.N().S(` qw422016.N().S(`
<main class="main-width"> <main class="main-width">
<section> <section>
<p>`) <p>`)
//line views/readers.qtpl:141 //line views/readers.qtpl:142
qw422016.E().S(lc.Get("ui.revision_warning")) qw422016.E().S(meta.Lc.Get("ui.revision_warning"))
//line views/readers.qtpl:141 //line views/readers.qtpl:142
qw422016.N().S(` <a href="/rev-text/`) qw422016.N().S(` <a href="/rev-text/`)
//line views/readers.qtpl:141 //line views/readers.qtpl:142
qw422016.E().S(revHash) qw422016.E().S(revHash)
//line views/readers.qtpl:141 //line views/readers.qtpl:142
qw422016.N().S(`/`) qw422016.N().S(`/`)
//line views/readers.qtpl:141 //line views/readers.qtpl:142
qw422016.E().S(h.CanonicalName()) qw422016.E().S(h.CanonicalName())
//line views/readers.qtpl:141 //line views/readers.qtpl:142
qw422016.N().S(`">`) qw422016.N().S(`">`)
//line views/readers.qtpl:141 //line views/readers.qtpl:142
qw422016.E().S(lc.Get("ui.revision_link")) qw422016.E().S(meta.Lc.Get("ui.revision_link"))
//line views/readers.qtpl:141 //line views/readers.qtpl:142
qw422016.N().S(`</a></p> qw422016.N().S(`</a></p>
`) `)
//line views/readers.qtpl:142 //line views/readers.qtpl:143
qw422016.N().S(NaviTitle(h)) qw422016.N().S(hypview.NaviTitle(meta, h.CanonicalName()))
//line views/readers.qtpl:142 //line views/readers.qtpl:143
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/readers.qtpl:143 //line views/readers.qtpl:144
qw422016.N().S(contents) qw422016.N().S(contents)
//line views/readers.qtpl:143 //line views/readers.qtpl:144
qw422016.N().S(` qw422016.N().S(`
</section> </section>
</main> </main>
`) `)
//line views/readers.qtpl:146 //line views/readers.qtpl:147
streamviewScripts(qw422016) streamviewScripts(qw422016)
//line views/readers.qtpl:146 //line views/readers.qtpl:147
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/readers.qtpl:147 //line views/readers.qtpl:148
} }
//line views/readers.qtpl:147 //line views/readers.qtpl:148
func WriteRevision(qq422016 qtio422016.Writer, rq *http.Request, lc *l18n.Localizer, h hyphae.Hypha, contents, revHash string) { func WriteRevision(qq422016 qtio422016.Writer, meta viewutil.Meta, h hyphae.Hypha, contents, revHash string) {
//line views/readers.qtpl:147 //line views/readers.qtpl:148
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line views/readers.qtpl:147 //line views/readers.qtpl:148
StreamRevision(qw422016, rq, lc, h, contents, revHash) StreamRevision(qw422016, meta, h, contents, revHash)
//line views/readers.qtpl:147 //line views/readers.qtpl:148
qt422016.ReleaseWriter(qw422016) qt422016.ReleaseWriter(qw422016)
//line views/readers.qtpl:147 //line views/readers.qtpl:148
} }
//line views/readers.qtpl:147 //line views/readers.qtpl:148
func Revision(rq *http.Request, lc *l18n.Localizer, h hyphae.Hypha, contents, revHash string) string { func Revision(meta viewutil.Meta, h hyphae.Hypha, contents, revHash string) string {
//line views/readers.qtpl:147 //line views/readers.qtpl:148
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line views/readers.qtpl:147 //line views/readers.qtpl:148
WriteRevision(qb422016, rq, lc, h, contents, revHash) WriteRevision(qb422016, meta, h, contents, revHash)
//line views/readers.qtpl:147 //line views/readers.qtpl:148
qs422016 := string(qb422016.B) qs422016 := string(qb422016.B)
//line views/readers.qtpl:147 //line views/readers.qtpl:148
qt422016.ReleaseByteBuffer(qb422016) qt422016.ReleaseByteBuffer(qb422016)
//line views/readers.qtpl:147 //line views/readers.qtpl:148
return qs422016 return qs422016
//line views/readers.qtpl:147 //line views/readers.qtpl:148
} }
//line views/readers.qtpl:149 //line views/readers.qtpl:150
func streamviewScripts(qw422016 *qt422016.Writer) { func streamviewScripts(qw422016 *qt422016.Writer) {
//line views/readers.qtpl:149 //line views/readers.qtpl:150
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/readers.qtpl:150 //line views/readers.qtpl:151
for _, scriptPath := range cfg.ViewScripts { for _, scriptPath := range cfg.ViewScripts {
//line views/readers.qtpl:150 //line views/readers.qtpl:151
qw422016.N().S(` qw422016.N().S(`
<script src="`) <script src="`)
//line views/readers.qtpl:151 //line views/readers.qtpl:152
qw422016.E().S(scriptPath) qw422016.E().S(scriptPath)
//line views/readers.qtpl:151 //line views/readers.qtpl:152
qw422016.N().S(`"></script> qw422016.N().S(`"></script>
`) `)
//line views/readers.qtpl:152 //line views/readers.qtpl:153
} }
//line views/readers.qtpl:152 //line views/readers.qtpl:153
qw422016.N().S(` qw422016.N().S(`
`) `)
//line views/readers.qtpl:153 //line views/readers.qtpl:154
} }
//line views/readers.qtpl:153 //line views/readers.qtpl:154
func writeviewScripts(qq422016 qtio422016.Writer) { func writeviewScripts(qq422016 qtio422016.Writer) {
//line views/readers.qtpl:153 //line views/readers.qtpl:154
qw422016 := qt422016.AcquireWriter(qq422016) qw422016 := qt422016.AcquireWriter(qq422016)
//line views/readers.qtpl:153 //line views/readers.qtpl:154
streamviewScripts(qw422016) streamviewScripts(qw422016)
//line views/readers.qtpl:153 //line views/readers.qtpl:154
qt422016.ReleaseWriter(qw422016) qt422016.ReleaseWriter(qw422016)
//line views/readers.qtpl:153 //line views/readers.qtpl:154
} }
//line views/readers.qtpl:153 //line views/readers.qtpl:154
func viewScripts() string { func viewScripts() string {
//line views/readers.qtpl:153 //line views/readers.qtpl:154
qb422016 := qt422016.AcquireByteBuffer() qb422016 := qt422016.AcquireByteBuffer()
//line views/readers.qtpl:153 //line views/readers.qtpl:154
writeviewScripts(qb422016) writeviewScripts(qb422016)
//line views/readers.qtpl:153 //line views/readers.qtpl:154
qs422016 := string(qb422016.B) qs422016 := string(qb422016.B)
//line views/readers.qtpl:153 //line views/readers.qtpl:154
qt422016.ReleaseByteBuffer(qb422016) qt422016.ReleaseByteBuffer(qb422016)
//line views/readers.qtpl:153 //line views/readers.qtpl:154
return qs422016 return qs422016
//line views/readers.qtpl:153 //line views/readers.qtpl:154
} }

View File

@ -35,6 +35,7 @@ func Init() {
BaseEn = m(m(template.New(""). BaseEn = m(m(template.New("").
Funcs(template.FuncMap{ Funcs(template.FuncMap{
"beautifulName": util.BeautifulName, "beautifulName": util.BeautifulName,
"inc": func(i int) int { return i + 1 },
}).ParseFS(fsys, "base.html")). }).ParseFS(fsys, "base.html")).
Parse(dataText)) Parse(dataText))
if !cfg.UseAuth { if !cfg.UseAuth {

View File

@ -145,8 +145,7 @@ func handlerRevision(w http.ResponseWriter, rq *http.Request) {
} }
} }
page := views.Revision( page := views.Revision(
rq, viewutil.MetaFrom(w, rq),
lc,
h, h,
contents, contents,
revHash, revHash,

View File

@ -5,6 +5,7 @@ import (
"github.com/bouncepaw/mycorrhiza/backlinks" "github.com/bouncepaw/mycorrhiza/backlinks"
"github.com/bouncepaw/mycorrhiza/categories" "github.com/bouncepaw/mycorrhiza/categories"
"github.com/bouncepaw/mycorrhiza/help" "github.com/bouncepaw/mycorrhiza/help"
"github.com/bouncepaw/mycorrhiza/hypview"
"github.com/bouncepaw/mycorrhiza/misc" "github.com/bouncepaw/mycorrhiza/misc"
"io" "io"
"net/http" "net/http"
@ -52,6 +53,7 @@ func Handler() http.Handler {
backlinks.InitHandlers(wikiRouter) backlinks.InitHandlers(wikiRouter)
categories.InitHandlers(wikiRouter) categories.InitHandlers(wikiRouter)
misc.InitHandlers(wikiRouter) misc.InitHandlers(wikiRouter)
hypview.Init()
// Admin routes. // Admin routes.
if cfg.UseAuth { if cfg.UseAuth {