mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2025-01-05 17:40:26 +00:00
Move navititle, attachment block, backlinks sidebar to the new views module
This commit is contained in:
parent
0467f3a773
commit
bcaa1de6b7
@ -13,11 +13,11 @@ import (
|
||||
"github.com/bouncepaw/mycorrhiza/hyphae"
|
||||
"github.com/bouncepaw/mycorrhiza/markup"
|
||||
"github.com/bouncepaw/mycorrhiza/mimetype"
|
||||
"github.com/bouncepaw/mycorrhiza/shroom"
|
||||
"github.com/bouncepaw/mycorrhiza/templates"
|
||||
"github.com/bouncepaw/mycorrhiza/tree"
|
||||
"github.com/bouncepaw/mycorrhiza/user"
|
||||
"github.com/bouncepaw/mycorrhiza/util"
|
||||
"github.com/bouncepaw/mycorrhiza/views"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -36,9 +36,9 @@ func handlerRevision(w http.ResponseWriter, rq *http.Request) {
|
||||
firstSlashIndex = strings.IndexRune(shorterUrl, '/')
|
||||
revHash = shorterUrl[:firstSlashIndex]
|
||||
hyphaName = util.CanonicalName(shorterUrl[firstSlashIndex+1:])
|
||||
h = hyphae.ByName(hyphaName)
|
||||
contents = fmt.Sprintf(`<p>This hypha had no text at this revision.</p>`)
|
||||
TextPath = hyphaName + ".myco"
|
||||
textContents, err = history.FileAtRevision(TextPath, revHash)
|
||||
textContents, err = history.FileAtRevision(h.TextPath, revHash)
|
||||
u = user.FromRequest(rq)
|
||||
)
|
||||
if err == nil {
|
||||
@ -47,8 +47,7 @@ func handlerRevision(w http.ResponseWriter, rq *http.Request) {
|
||||
treeHTML, subhyphae, _, _ := tree.Tree(hyphaName)
|
||||
page := templates.RevisionHTML(
|
||||
rq,
|
||||
hyphaName,
|
||||
naviTitle(hyphaName),
|
||||
h,
|
||||
contents,
|
||||
treeHTML,
|
||||
subhyphae,
|
||||
@ -87,7 +86,6 @@ func handlerHypha(w http.ResponseWriter, rq *http.Request) {
|
||||
var (
|
||||
hyphaName = HyphaNameFromRq(rq, "page", "hypha")
|
||||
h = hyphae.ByName(hyphaName)
|
||||
hasAmnt = h.Exists && h.BinaryPath != ""
|
||||
contents string
|
||||
openGraph string
|
||||
u = user.FromRequest(rq)
|
||||
@ -101,21 +99,19 @@ func handlerHypha(w http.ResponseWriter, rq *http.Request) {
|
||||
openGraph = md.OpenGraphHTML()
|
||||
}
|
||||
if !os.IsNotExist(errB) {
|
||||
contents = shroom.BinaryHtmlBlock(h) + contents
|
||||
contents = views.AttachmentHTML(h) + contents
|
||||
}
|
||||
}
|
||||
treeHTML, subhyphaeHTML, prevHypha, nextHypha := tree.Tree(hyphaName)
|
||||
util.HTTP200Page(w,
|
||||
templates.BaseHTML(
|
||||
util.BeautifulName(hyphaName),
|
||||
templates.PageHTML(rq, hyphaName,
|
||||
naviTitle(hyphaName),
|
||||
templates.PageHTML(rq, h,
|
||||
contents,
|
||||
treeHTML,
|
||||
subhyphaeHTML,
|
||||
shroom.BackLinkEntriesHTML(h),
|
||||
prevHypha, nextHypha,
|
||||
hasAmnt),
|
||||
),
|
||||
u,
|
||||
openGraph))
|
||||
}
|
||||
|
1
main.go
1
main.go
@ -1,5 +1,6 @@
|
||||
//go:generate go get -u github.com/valyala/quicktemplate/qtc
|
||||
//go:generate qtc -dir=templates
|
||||
//go:generate qtc -dir=views
|
||||
package main
|
||||
|
||||
import (
|
||||
|
29
name.go
29
name.go
@ -1,7 +1,6 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"strings"
|
||||
@ -11,34 +10,6 @@ import (
|
||||
"github.com/bouncepaw/mycorrhiza/util"
|
||||
)
|
||||
|
||||
// naviTitle turns `canonicalName` into html string with each hypha path parts higlighted as links.
|
||||
// TODO: rework as a template
|
||||
func naviTitle(canonicalName string) string {
|
||||
var (
|
||||
html = fmt.Sprintf(`<h1 class="navi-title" id="navi-title">
|
||||
<a href="/hypha/%s">%s</a><span aria-hidden="true" class="navi-title__colon">:</span>`, util.HomePage, util.SiteNavIcon)
|
||||
prevAcc = `/hypha/`
|
||||
parts = strings.Split(canonicalName, "/")
|
||||
rel = "up"
|
||||
)
|
||||
for i, part := range parts {
|
||||
if i > 0 {
|
||||
html += `<span aria-hidden="true" class="navi-title__separator">/</span>`
|
||||
}
|
||||
if i == len(parts)-1 {
|
||||
rel = "bookmark"
|
||||
}
|
||||
html += fmt.Sprintf(
|
||||
`<a href="%s" rel="%s">%s</a>`,
|
||||
prevAcc+part,
|
||||
rel,
|
||||
util.BeautifulName(part),
|
||||
)
|
||||
prevAcc += part + "/"
|
||||
}
|
||||
return html + "</h1>"
|
||||
}
|
||||
|
||||
// HyphaNameFromRq extracts hypha name from http request. You have to also pass the action which is embedded in the url or several actions. For url /hypha/hypha, the action would be "hypha".
|
||||
func HyphaNameFromRq(rq *http.Request, actions ...string) string {
|
||||
p := rq.URL.Path
|
||||
|
@ -1,26 +1,14 @@
|
||||
package shroom
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"sync"
|
||||
|
||||
"github.com/bouncepaw/mycorrhiza/hyphae"
|
||||
"github.com/bouncepaw/mycorrhiza/link"
|
||||
"github.com/bouncepaw/mycorrhiza/markup"
|
||||
"github.com/bouncepaw/mycorrhiza/util"
|
||||
)
|
||||
|
||||
func BackLinkEntriesHTML(h *hyphae.Hypha) (html string) {
|
||||
for _, backlinkHypha := range h.BackLinks {
|
||||
_ = link.Link{}
|
||||
html += fmt.Sprintf(`<li class="backlinks__entry">
|
||||
<a class="backlinks__link" href="/hypha/%s">%s</a>`, backlinkHypha.Name, util.BeautifulName(backlinkHypha.Name))
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// FindAllBacklinks iterates over all hyphae that have text parts, sets their outlinks and then sets backlinks.
|
||||
func FindAllBacklinks() {
|
||||
for h := range hyphae.FilterTextHyphae(hyphae.YieldExistingHyphae()) {
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"github.com/bouncepaw/mycorrhiza/hyphae"
|
||||
"github.com/bouncepaw/mycorrhiza/markup"
|
||||
"github.com/bouncepaw/mycorrhiza/util"
|
||||
"github.com/bouncepaw/mycorrhiza/views"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -16,7 +17,7 @@ func init() {
|
||||
if h := hyphae.ByName(hyphaName); h.Exists {
|
||||
rawText, err = FetchTextPart(h)
|
||||
if h.BinaryPath != "" {
|
||||
binaryBlock = BinaryHtmlBlock(h)
|
||||
binaryBlock = views.AttachmentHTML(h)
|
||||
}
|
||||
} else {
|
||||
err = errors.New("Hypha " + hyphaName + " does not exist")
|
||||
|
@ -1,10 +1,8 @@
|
||||
package shroom
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/bouncepaw/mycorrhiza/hyphae"
|
||||
"github.com/bouncepaw/mycorrhiza/markup"
|
||||
@ -25,39 +23,6 @@ func FetchTextPart(h *hyphae.Hypha) (string, error) {
|
||||
return string(text), nil
|
||||
}
|
||||
|
||||
// binaryHtmlBlock creates an html block for binary part of the hypha.
|
||||
func BinaryHtmlBlock(h *hyphae.Hypha) string {
|
||||
switch filepath.Ext(h.BinaryPath) {
|
||||
case ".jpg", ".gif", ".png", ".webp", ".svg", ".ico":
|
||||
return fmt.Sprintf(`
|
||||
<div class="binary-container binary-container_with-img">
|
||||
<a href="/binary/%[1]s"><img src="/binary/%[1]s"/></a>
|
||||
</div>`, h.Name)
|
||||
case ".ogg", ".webm", ".mp4":
|
||||
return fmt.Sprintf(`
|
||||
<div class="binary-container binary-container_with-video">
|
||||
<video controls>
|
||||
<source src="/binary/%[1]s"/>
|
||||
<p>Your browser does not support video. <a href="/binary/%[1]s">Download video</a></p>
|
||||
</video>
|
||||
`, h.Name)
|
||||
case ".mp3":
|
||||
return fmt.Sprintf(`
|
||||
<div class="binary-container binary-container_with-audio">
|
||||
<audio controls>
|
||||
<source src="/binary/%[1]s"/>
|
||||
<p>Your browser does not support audio. <a href="/binary/%[1]s">Download audio</a></p>
|
||||
</audio>
|
||||
`, h.Name)
|
||||
default:
|
||||
return fmt.Sprintf(`
|
||||
<div class="binary-container binary-container_with-nothing">
|
||||
<p><a href="/binary/%s">Download media</a></p>
|
||||
</div>
|
||||
`, h.Name)
|
||||
}
|
||||
}
|
||||
|
||||
func SetHeaderLinks() {
|
||||
if userLinksHypha := hyphae.ByName(util.HeaderLinksHypha); !userLinksHypha.Exists {
|
||||
util.SetDefaultHeaderLinks()
|
||||
|
@ -64,17 +64,6 @@ var navEntries = []navEntry{
|
||||
</aside>
|
||||
{% endfunc %}
|
||||
|
||||
{% func backlinks(backlinkEntries string) %}
|
||||
<aside class="backlinks layout-card">
|
||||
<h2 class="backlinks__title layout-card__title">Backlinks</h2>
|
||||
<nav class="backlinks__nav">
|
||||
<ul class="backlinks__list">
|
||||
{%s= backlinkEntries %}
|
||||
</ul>
|
||||
</nav>
|
||||
</aside>
|
||||
{% endfunc %}
|
||||
|
||||
{% func subhyphaeMatrix(subhyphae string) %}
|
||||
{% if strings.TrimSpace(subhyphae) != "" %}
|
||||
<section class="subhyphae">
|
||||
|
@ -258,103 +258,57 @@ func relativeHyphae(relatives string) string {
|
||||
}
|
||||
|
||||
//line templates/common.qtpl:67
|
||||
func streambacklinks(qw422016 *qt422016.Writer, backlinkEntries string) {
|
||||
func streamsubhyphaeMatrix(qw422016 *qt422016.Writer, subhyphae string) {
|
||||
//line templates/common.qtpl:67
|
||||
qw422016.N().S(`
|
||||
<aside class="backlinks layout-card">
|
||||
<h2 class="backlinks__title layout-card__title">Backlinks</h2>
|
||||
<nav class="backlinks__nav">
|
||||
<ul class="backlinks__list">
|
||||
`)
|
||||
//line templates/common.qtpl:72
|
||||
qw422016.N().S(backlinkEntries)
|
||||
//line templates/common.qtpl:72
|
||||
qw422016.N().S(`
|
||||
</ul>
|
||||
</nav>
|
||||
</aside>
|
||||
`)
|
||||
//line templates/common.qtpl:76
|
||||
}
|
||||
|
||||
//line templates/common.qtpl:76
|
||||
func writebacklinks(qq422016 qtio422016.Writer, backlinkEntries string) {
|
||||
//line templates/common.qtpl:76
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/common.qtpl:76
|
||||
streambacklinks(qw422016, backlinkEntries)
|
||||
//line templates/common.qtpl:76
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line templates/common.qtpl:76
|
||||
}
|
||||
|
||||
//line templates/common.qtpl:76
|
||||
func backlinks(backlinkEntries string) string {
|
||||
//line templates/common.qtpl:76
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/common.qtpl:76
|
||||
writebacklinks(qb422016, backlinkEntries)
|
||||
//line templates/common.qtpl:76
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/common.qtpl:76
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/common.qtpl:76
|
||||
return qs422016
|
||||
//line templates/common.qtpl:76
|
||||
}
|
||||
|
||||
//line templates/common.qtpl:78
|
||||
func streamsubhyphaeMatrix(qw422016 *qt422016.Writer, subhyphae string) {
|
||||
//line templates/common.qtpl:78
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/common.qtpl:79
|
||||
//line templates/common.qtpl:68
|
||||
if strings.TrimSpace(subhyphae) != "" {
|
||||
//line templates/common.qtpl:79
|
||||
//line templates/common.qtpl:68
|
||||
qw422016.N().S(`
|
||||
<section class="subhyphae">
|
||||
<h2 class="subhyphae__title">Subhyphae</h2>
|
||||
<nav class="subhyphae__nav">
|
||||
<ul class="subhyphae__list">
|
||||
`)
|
||||
//line templates/common.qtpl:84
|
||||
//line templates/common.qtpl:73
|
||||
qw422016.N().S(subhyphae)
|
||||
//line templates/common.qtpl:84
|
||||
//line templates/common.qtpl:73
|
||||
qw422016.N().S(`
|
||||
</ul>
|
||||
</nav>
|
||||
</section>
|
||||
`)
|
||||
//line templates/common.qtpl:88
|
||||
//line templates/common.qtpl:77
|
||||
}
|
||||
//line templates/common.qtpl:88
|
||||
//line templates/common.qtpl:77
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/common.qtpl:89
|
||||
//line templates/common.qtpl:78
|
||||
}
|
||||
|
||||
//line templates/common.qtpl:89
|
||||
//line templates/common.qtpl:78
|
||||
func writesubhyphaeMatrix(qq422016 qtio422016.Writer, subhyphae string) {
|
||||
//line templates/common.qtpl:89
|
||||
//line templates/common.qtpl:78
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/common.qtpl:89
|
||||
//line templates/common.qtpl:78
|
||||
streamsubhyphaeMatrix(qw422016, subhyphae)
|
||||
//line templates/common.qtpl:89
|
||||
//line templates/common.qtpl:78
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line templates/common.qtpl:89
|
||||
//line templates/common.qtpl:78
|
||||
}
|
||||
|
||||
//line templates/common.qtpl:89
|
||||
//line templates/common.qtpl:78
|
||||
func subhyphaeMatrix(subhyphae string) string {
|
||||
//line templates/common.qtpl:89
|
||||
//line templates/common.qtpl:78
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/common.qtpl:89
|
||||
//line templates/common.qtpl:78
|
||||
writesubhyphaeMatrix(qb422016, subhyphae)
|
||||
//line templates/common.qtpl:89
|
||||
//line templates/common.qtpl:78
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/common.qtpl:89
|
||||
//line templates/common.qtpl:78
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/common.qtpl:89
|
||||
//line templates/common.qtpl:78
|
||||
return qs422016
|
||||
//line templates/common.qtpl:89
|
||||
//line templates/common.qtpl:78
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
{% import "net/http" %}
|
||||
{% import "path" %}
|
||||
{% import "github.com/bouncepaw/mycorrhiza/hyphae" %}
|
||||
{% import "github.com/bouncepaw/mycorrhiza/user" %}
|
||||
{% import "github.com/bouncepaw/mycorrhiza/util" %}
|
||||
{% import "github.com/bouncepaw/mycorrhiza/views" %}
|
||||
|
||||
{% func HistoryHTML(rq *http.Request, hyphaName, list string) %}
|
||||
{%= navHTML(rq, hyphaName, "history") %}
|
||||
@ -15,13 +17,13 @@
|
||||
</div>
|
||||
{% endfunc %}
|
||||
|
||||
{% func RevisionHTML(rq *http.Request, hyphaName, naviTitle, contents, relatives, subhyphae, revHash string) %}
|
||||
{%= navHTML(rq, hyphaName, "revision", revHash) %}
|
||||
{% func RevisionHTML(rq *http.Request, h *hyphae.Hypha, contents, relatives, subhyphae, revHash string) %}
|
||||
{%= navHTML(rq, h.Name, "revision", revHash) %}
|
||||
<div class="layout">
|
||||
<main class="main-width">
|
||||
<article>
|
||||
<p>Please note that viewing binary parts of hyphae is not supported in history for now.</p>
|
||||
{%s= naviTitle %}
|
||||
{%s= views.NaviTitleHTML(h) %}
|
||||
{%s= contents %}
|
||||
</article>
|
||||
{%= subhyphaeMatrix(subhyphae) %}
|
||||
@ -31,14 +33,14 @@
|
||||
{% endfunc %}
|
||||
|
||||
If `contents` == "", a helpful message is shown instead.
|
||||
{% func PageHTML(rq *http.Request, hyphaName, naviTitle, contents, relatives, subhyphae, backlinkEntries, prevHyphaName, nextHyphaName string, hasAmnt bool) %}
|
||||
{%= navHTML(rq, hyphaName, "page") %}
|
||||
{% func PageHTML(rq *http.Request, h *hyphae.Hypha, contents, relatives, subhyphae, prevHyphaName, nextHyphaName string) %}
|
||||
{%= navHTML(rq, h.Name, "page") %}
|
||||
<div class="layout">
|
||||
<main class="main-width">
|
||||
<article>
|
||||
{%s= naviTitle %}
|
||||
{%s= views.NaviTitleHTML(h) %}
|
||||
{% if contents == "" %}
|
||||
<p>This hypha has no text. Why not <a href="/edit/{%s hyphaName %}">create it</a>?</p>
|
||||
<p>This hypha has no text. Why not <a href="/edit/{%s h.Name %}">create it</a>?</p>
|
||||
{% else %}
|
||||
{%s= contents %}
|
||||
{% endif %}
|
||||
@ -52,11 +54,11 @@ If `contents` == "", a helpful message is shown instead.
|
||||
{% endif %}
|
||||
</section>
|
||||
{% if u := user.FromRequest(rq); !user.AuthUsed || u.Group != "anon" %}
|
||||
<form action="/upload-binary/{%s hyphaName %}"
|
||||
<form action="/upload-binary/{%s h.Name %}"
|
||||
method="post" enctype="multipart/form-data"
|
||||
class="upload-amnt">
|
||||
{% if hasAmnt %}
|
||||
<a class="upload-amnt__unattach" href="/unattach-ask/{%s hyphaName %}">Unattach current attachment?</a>
|
||||
{% if h.Exists && h.BinaryPath != "" %}
|
||||
<a class="upload-amnt__unattach" href="/unattach-ask/{%s h.Name %}">Unattach current attachment?</a>
|
||||
{% endif %}
|
||||
<label for="upload-binary__input">Upload a new attachment</label>
|
||||
<br>
|
||||
@ -67,6 +69,6 @@ If `contents` == "", a helpful message is shown instead.
|
||||
{%= subhyphaeMatrix(subhyphae) %}
|
||||
</main>
|
||||
{%= relativeHyphae(relatives) %}
|
||||
{%= backlinks(backlinkEntries) %}
|
||||
{%= views.BackLinksHTML(h) %}
|
||||
</div>
|
||||
{% endfunc %}
|
||||
|
@ -11,256 +11,262 @@ import "net/http"
|
||||
import "path"
|
||||
|
||||
//line templates/readers.qtpl:3
|
||||
import "github.com/bouncepaw/mycorrhiza/user"
|
||||
import "github.com/bouncepaw/mycorrhiza/hyphae"
|
||||
|
||||
//line templates/readers.qtpl:4
|
||||
import "github.com/bouncepaw/mycorrhiza/user"
|
||||
|
||||
//line templates/readers.qtpl:5
|
||||
import "github.com/bouncepaw/mycorrhiza/util"
|
||||
|
||||
//line templates/readers.qtpl:6
|
||||
import "github.com/bouncepaw/mycorrhiza/views"
|
||||
|
||||
//line templates/readers.qtpl:8
|
||||
import (
|
||||
qtio422016 "io"
|
||||
|
||||
qt422016 "github.com/valyala/quicktemplate"
|
||||
)
|
||||
|
||||
//line templates/readers.qtpl:6
|
||||
//line templates/readers.qtpl:8
|
||||
var (
|
||||
_ = qtio422016.Copy
|
||||
_ = qt422016.AcquireByteBuffer
|
||||
)
|
||||
|
||||
//line templates/readers.qtpl:6
|
||||
//line templates/readers.qtpl:8
|
||||
func StreamHistoryHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, list string) {
|
||||
//line templates/readers.qtpl:6
|
||||
//line templates/readers.qtpl:8
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/readers.qtpl:7
|
||||
//line templates/readers.qtpl:9
|
||||
streamnavHTML(qw422016, rq, hyphaName, "history")
|
||||
//line templates/readers.qtpl:7
|
||||
//line templates/readers.qtpl:9
|
||||
qw422016.N().S(`
|
||||
<div class="layout">
|
||||
<main class="main-width">
|
||||
<article class="history">
|
||||
<h1>History of `)
|
||||
//line templates/readers.qtpl:11
|
||||
//line templates/readers.qtpl:13
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/readers.qtpl:11
|
||||
//line templates/readers.qtpl:13
|
||||
qw422016.N().S(`</h1>
|
||||
`)
|
||||
//line templates/readers.qtpl:12
|
||||
//line templates/readers.qtpl:14
|
||||
qw422016.N().S(list)
|
||||
//line templates/readers.qtpl:12
|
||||
//line templates/readers.qtpl:14
|
||||
qw422016.N().S(`
|
||||
</article>
|
||||
</main>
|
||||
</div>
|
||||
`)
|
||||
//line templates/readers.qtpl:16
|
||||
//line templates/readers.qtpl:18
|
||||
}
|
||||
|
||||
//line templates/readers.qtpl:16
|
||||
//line templates/readers.qtpl:18
|
||||
func WriteHistoryHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, list string) {
|
||||
//line templates/readers.qtpl:16
|
||||
//line templates/readers.qtpl:18
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/readers.qtpl:16
|
||||
//line templates/readers.qtpl:18
|
||||
StreamHistoryHTML(qw422016, rq, hyphaName, list)
|
||||
//line templates/readers.qtpl:16
|
||||
//line templates/readers.qtpl:18
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line templates/readers.qtpl:16
|
||||
//line templates/readers.qtpl:18
|
||||
}
|
||||
|
||||
//line templates/readers.qtpl:16
|
||||
//line templates/readers.qtpl:18
|
||||
func HistoryHTML(rq *http.Request, hyphaName, list string) string {
|
||||
//line templates/readers.qtpl:16
|
||||
//line templates/readers.qtpl:18
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/readers.qtpl:16
|
||||
//line templates/readers.qtpl:18
|
||||
WriteHistoryHTML(qb422016, rq, hyphaName, list)
|
||||
//line templates/readers.qtpl:16
|
||||
//line templates/readers.qtpl:18
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/readers.qtpl:16
|
||||
//line templates/readers.qtpl:18
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/readers.qtpl:16
|
||||
//line templates/readers.qtpl:18
|
||||
return qs422016
|
||||
//line templates/readers.qtpl:16
|
||||
//line templates/readers.qtpl:18
|
||||
}
|
||||
|
||||
//line templates/readers.qtpl:18
|
||||
func StreamRevisionHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, naviTitle, contents, relatives, subhyphae, revHash string) {
|
||||
//line templates/readers.qtpl:18
|
||||
//line templates/readers.qtpl:20
|
||||
func StreamRevisionHTML(qw422016 *qt422016.Writer, rq *http.Request, h *hyphae.Hypha, contents, relatives, subhyphae, revHash string) {
|
||||
//line templates/readers.qtpl:20
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/readers.qtpl:19
|
||||
streamnavHTML(qw422016, rq, hyphaName, "revision", revHash)
|
||||
//line templates/readers.qtpl:19
|
||||
//line templates/readers.qtpl:21
|
||||
streamnavHTML(qw422016, rq, h.Name, "revision", revHash)
|
||||
//line templates/readers.qtpl:21
|
||||
qw422016.N().S(`
|
||||
<div class="layout">
|
||||
<main class="main-width">
|
||||
<article>
|
||||
<p>Please note that viewing binary parts of hyphae is not supported in history for now.</p>
|
||||
`)
|
||||
//line templates/readers.qtpl:24
|
||||
qw422016.N().S(naviTitle)
|
||||
//line templates/readers.qtpl:24
|
||||
//line templates/readers.qtpl:26
|
||||
qw422016.N().S(views.NaviTitleHTML(h))
|
||||
//line templates/readers.qtpl:26
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/readers.qtpl:25
|
||||
//line templates/readers.qtpl:27
|
||||
qw422016.N().S(contents)
|
||||
//line templates/readers.qtpl:25
|
||||
//line templates/readers.qtpl:27
|
||||
qw422016.N().S(`
|
||||
</article>
|
||||
`)
|
||||
//line templates/readers.qtpl:27
|
||||
//line templates/readers.qtpl:29
|
||||
streamsubhyphaeMatrix(qw422016, subhyphae)
|
||||
//line templates/readers.qtpl:27
|
||||
//line templates/readers.qtpl:29
|
||||
qw422016.N().S(`
|
||||
</main>
|
||||
`)
|
||||
//line templates/readers.qtpl:29
|
||||
//line templates/readers.qtpl:31
|
||||
streamrelativeHyphae(qw422016, relatives)
|
||||
//line templates/readers.qtpl:29
|
||||
//line templates/readers.qtpl:31
|
||||
qw422016.N().S(`
|
||||
</div>
|
||||
`)
|
||||
//line templates/readers.qtpl:31
|
||||
//line templates/readers.qtpl:33
|
||||
}
|
||||
|
||||
//line templates/readers.qtpl:31
|
||||
func WriteRevisionHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, naviTitle, contents, relatives, subhyphae, revHash string) {
|
||||
//line templates/readers.qtpl:31
|
||||
//line templates/readers.qtpl:33
|
||||
func WriteRevisionHTML(qq422016 qtio422016.Writer, rq *http.Request, h *hyphae.Hypha, contents, relatives, subhyphae, revHash string) {
|
||||
//line templates/readers.qtpl:33
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/readers.qtpl:31
|
||||
StreamRevisionHTML(qw422016, rq, hyphaName, naviTitle, contents, relatives, subhyphae, revHash)
|
||||
//line templates/readers.qtpl:31
|
||||
//line templates/readers.qtpl:33
|
||||
StreamRevisionHTML(qw422016, rq, h, contents, relatives, subhyphae, revHash)
|
||||
//line templates/readers.qtpl:33
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line templates/readers.qtpl:31
|
||||
//line templates/readers.qtpl:33
|
||||
}
|
||||
|
||||
//line templates/readers.qtpl:31
|
||||
func RevisionHTML(rq *http.Request, hyphaName, naviTitle, contents, relatives, subhyphae, revHash string) string {
|
||||
//line templates/readers.qtpl:31
|
||||
//line templates/readers.qtpl:33
|
||||
func RevisionHTML(rq *http.Request, h *hyphae.Hypha, contents, relatives, subhyphae, revHash string) string {
|
||||
//line templates/readers.qtpl:33
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/readers.qtpl:31
|
||||
WriteRevisionHTML(qb422016, rq, hyphaName, naviTitle, contents, relatives, subhyphae, revHash)
|
||||
//line templates/readers.qtpl:31
|
||||
//line templates/readers.qtpl:33
|
||||
WriteRevisionHTML(qb422016, rq, h, contents, relatives, subhyphae, revHash)
|
||||
//line templates/readers.qtpl:33
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/readers.qtpl:31
|
||||
//line templates/readers.qtpl:33
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/readers.qtpl:31
|
||||
//line templates/readers.qtpl:33
|
||||
return qs422016
|
||||
//line templates/readers.qtpl:31
|
||||
//line templates/readers.qtpl:33
|
||||
}
|
||||
|
||||
// If `contents` == "", a helpful message is shown instead.
|
||||
|
||||
//line templates/readers.qtpl:34
|
||||
func StreamPageHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, naviTitle, contents, relatives, subhyphae, backlinkEntries, prevHyphaName, nextHyphaName string, hasAmnt bool) {
|
||||
//line templates/readers.qtpl:34
|
||||
//line templates/readers.qtpl:36
|
||||
func StreamPageHTML(qw422016 *qt422016.Writer, rq *http.Request, h *hyphae.Hypha, contents, relatives, subhyphae, prevHyphaName, nextHyphaName string) {
|
||||
//line templates/readers.qtpl:36
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/readers.qtpl:35
|
||||
streamnavHTML(qw422016, rq, hyphaName, "page")
|
||||
//line templates/readers.qtpl:35
|
||||
//line templates/readers.qtpl:37
|
||||
streamnavHTML(qw422016, rq, h.Name, "page")
|
||||
//line templates/readers.qtpl:37
|
||||
qw422016.N().S(`
|
||||
<div class="layout">
|
||||
<main class="main-width">
|
||||
<article>
|
||||
`)
|
||||
//line templates/readers.qtpl:39
|
||||
qw422016.N().S(naviTitle)
|
||||
//line templates/readers.qtpl:39
|
||||
//line templates/readers.qtpl:41
|
||||
qw422016.N().S(views.NaviTitleHTML(h))
|
||||
//line templates/readers.qtpl:41
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/readers.qtpl:40
|
||||
//line templates/readers.qtpl:42
|
||||
if contents == "" {
|
||||
//line templates/readers.qtpl:40
|
||||
//line templates/readers.qtpl:42
|
||||
qw422016.N().S(`
|
||||
<p>This hypha has no text. Why not <a href="/edit/`)
|
||||
//line templates/readers.qtpl:41
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/readers.qtpl:41
|
||||
//line templates/readers.qtpl:43
|
||||
qw422016.E().S(h.Name)
|
||||
//line templates/readers.qtpl:43
|
||||
qw422016.N().S(`">create it</a>?</p>
|
||||
`)
|
||||
//line templates/readers.qtpl:42
|
||||
//line templates/readers.qtpl:44
|
||||
} else {
|
||||
//line templates/readers.qtpl:42
|
||||
//line templates/readers.qtpl:44
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/readers.qtpl:43
|
||||
//line templates/readers.qtpl:45
|
||||
qw422016.N().S(contents)
|
||||
//line templates/readers.qtpl:43
|
||||
//line templates/readers.qtpl:45
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/readers.qtpl:44
|
||||
//line templates/readers.qtpl:46
|
||||
}
|
||||
//line templates/readers.qtpl:44
|
||||
//line templates/readers.qtpl:46
|
||||
qw422016.N().S(`
|
||||
</article>
|
||||
<section class="prevnext">
|
||||
`)
|
||||
//line templates/readers.qtpl:47
|
||||
//line templates/readers.qtpl:49
|
||||
if prevHyphaName != "" {
|
||||
//line templates/readers.qtpl:47
|
||||
//line templates/readers.qtpl:49
|
||||
qw422016.N().S(`
|
||||
<a class="prevnext__el prevnext__prev" href="/hypha/`)
|
||||
//line templates/readers.qtpl:48
|
||||
//line templates/readers.qtpl:50
|
||||
qw422016.E().S(prevHyphaName)
|
||||
//line templates/readers.qtpl:48
|
||||
//line templates/readers.qtpl:50
|
||||
qw422016.N().S(`" rel="prev">← `)
|
||||
//line templates/readers.qtpl:48
|
||||
//line templates/readers.qtpl:50
|
||||
qw422016.E().S(util.BeautifulName(path.Base(prevHyphaName)))
|
||||
//line templates/readers.qtpl:48
|
||||
//line templates/readers.qtpl:50
|
||||
qw422016.N().S(`</a>
|
||||
`)
|
||||
//line templates/readers.qtpl:49
|
||||
//line templates/readers.qtpl:51
|
||||
}
|
||||
//line templates/readers.qtpl:49
|
||||
//line templates/readers.qtpl:51
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/readers.qtpl:50
|
||||
//line templates/readers.qtpl:52
|
||||
if nextHyphaName != "" {
|
||||
//line templates/readers.qtpl:50
|
||||
//line templates/readers.qtpl:52
|
||||
qw422016.N().S(`
|
||||
<a class="prevnext__el prevnext__next" href="/hypha/`)
|
||||
//line templates/readers.qtpl:51
|
||||
//line templates/readers.qtpl:53
|
||||
qw422016.E().S(nextHyphaName)
|
||||
//line templates/readers.qtpl:51
|
||||
//line templates/readers.qtpl:53
|
||||
qw422016.N().S(`" rel="next">`)
|
||||
//line templates/readers.qtpl:51
|
||||
//line templates/readers.qtpl:53
|
||||
qw422016.E().S(util.BeautifulName(path.Base(nextHyphaName)))
|
||||
//line templates/readers.qtpl:51
|
||||
//line templates/readers.qtpl:53
|
||||
qw422016.N().S(` →</a>
|
||||
`)
|
||||
//line templates/readers.qtpl:52
|
||||
//line templates/readers.qtpl:54
|
||||
}
|
||||
//line templates/readers.qtpl:52
|
||||
//line templates/readers.qtpl:54
|
||||
qw422016.N().S(`
|
||||
</section>
|
||||
`)
|
||||
//line templates/readers.qtpl:54
|
||||
//line templates/readers.qtpl:56
|
||||
if u := user.FromRequest(rq); !user.AuthUsed || u.Group != "anon" {
|
||||
//line templates/readers.qtpl:54
|
||||
//line templates/readers.qtpl:56
|
||||
qw422016.N().S(`
|
||||
<form action="/upload-binary/`)
|
||||
//line templates/readers.qtpl:55
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/readers.qtpl:55
|
||||
//line templates/readers.qtpl:57
|
||||
qw422016.E().S(h.Name)
|
||||
//line templates/readers.qtpl:57
|
||||
qw422016.N().S(`"
|
||||
method="post" enctype="multipart/form-data"
|
||||
class="upload-amnt">
|
||||
`)
|
||||
//line templates/readers.qtpl:58
|
||||
if hasAmnt {
|
||||
//line templates/readers.qtpl:58
|
||||
//line templates/readers.qtpl:60
|
||||
if h.Exists && h.BinaryPath != "" {
|
||||
//line templates/readers.qtpl:60
|
||||
qw422016.N().S(`
|
||||
<a class="upload-amnt__unattach" href="/unattach-ask/`)
|
||||
//line templates/readers.qtpl:59
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/readers.qtpl:59
|
||||
//line templates/readers.qtpl:61
|
||||
qw422016.E().S(h.Name)
|
||||
//line templates/readers.qtpl:61
|
||||
qw422016.N().S(`">Unattach current attachment?</a>
|
||||
`)
|
||||
//line templates/readers.qtpl:60
|
||||
//line templates/readers.qtpl:62
|
||||
}
|
||||
//line templates/readers.qtpl:60
|
||||
//line templates/readers.qtpl:62
|
||||
qw422016.N().S(`
|
||||
<label for="upload-binary__input">Upload a new attachment</label>
|
||||
<br>
|
||||
@ -268,53 +274,53 @@ func StreamPageHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, navi
|
||||
<input type="submit"/>
|
||||
</form>
|
||||
`)
|
||||
//line templates/readers.qtpl:66
|
||||
//line templates/readers.qtpl:68
|
||||
}
|
||||
//line templates/readers.qtpl:66
|
||||
//line templates/readers.qtpl:68
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/readers.qtpl:67
|
||||
//line templates/readers.qtpl:69
|
||||
streamsubhyphaeMatrix(qw422016, subhyphae)
|
||||
//line templates/readers.qtpl:67
|
||||
//line templates/readers.qtpl:69
|
||||
qw422016.N().S(`
|
||||
</main>
|
||||
`)
|
||||
//line templates/readers.qtpl:69
|
||||
//line templates/readers.qtpl:71
|
||||
streamrelativeHyphae(qw422016, relatives)
|
||||
//line templates/readers.qtpl:69
|
||||
//line templates/readers.qtpl:71
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/readers.qtpl:70
|
||||
streambacklinks(qw422016, backlinkEntries)
|
||||
//line templates/readers.qtpl:70
|
||||
//line templates/readers.qtpl:72
|
||||
views.StreamBackLinksHTML(qw422016, h)
|
||||
//line templates/readers.qtpl:72
|
||||
qw422016.N().S(`
|
||||
</div>
|
||||
`)
|
||||
//line templates/readers.qtpl:72
|
||||
//line templates/readers.qtpl:74
|
||||
}
|
||||
|
||||
//line templates/readers.qtpl:72
|
||||
func WritePageHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, naviTitle, contents, relatives, subhyphae, backlinkEntries, prevHyphaName, nextHyphaName string, hasAmnt bool) {
|
||||
//line templates/readers.qtpl:72
|
||||
//line templates/readers.qtpl:74
|
||||
func WritePageHTML(qq422016 qtio422016.Writer, rq *http.Request, h *hyphae.Hypha, contents, relatives, subhyphae, prevHyphaName, nextHyphaName string) {
|
||||
//line templates/readers.qtpl:74
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/readers.qtpl:72
|
||||
StreamPageHTML(qw422016, rq, hyphaName, naviTitle, contents, relatives, subhyphae, backlinkEntries, prevHyphaName, nextHyphaName, hasAmnt)
|
||||
//line templates/readers.qtpl:72
|
||||
//line templates/readers.qtpl:74
|
||||
StreamPageHTML(qw422016, rq, h, contents, relatives, subhyphae, prevHyphaName, nextHyphaName)
|
||||
//line templates/readers.qtpl:74
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line templates/readers.qtpl:72
|
||||
//line templates/readers.qtpl:74
|
||||
}
|
||||
|
||||
//line templates/readers.qtpl:72
|
||||
func PageHTML(rq *http.Request, hyphaName, naviTitle, contents, relatives, subhyphae, backlinkEntries, prevHyphaName, nextHyphaName string, hasAmnt bool) string {
|
||||
//line templates/readers.qtpl:72
|
||||
//line templates/readers.qtpl:74
|
||||
func PageHTML(rq *http.Request, h *hyphae.Hypha, contents, relatives, subhyphae, prevHyphaName, nextHyphaName string) string {
|
||||
//line templates/readers.qtpl:74
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/readers.qtpl:72
|
||||
WritePageHTML(qb422016, rq, hyphaName, naviTitle, contents, relatives, subhyphae, backlinkEntries, prevHyphaName, nextHyphaName, hasAmnt)
|
||||
//line templates/readers.qtpl:72
|
||||
//line templates/readers.qtpl:74
|
||||
WritePageHTML(qb422016, rq, h, contents, relatives, subhyphae, prevHyphaName, nextHyphaName)
|
||||
//line templates/readers.qtpl:74
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/readers.qtpl:72
|
||||
//line templates/readers.qtpl:74
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/readers.qtpl:72
|
||||
//line templates/readers.qtpl:74
|
||||
return qs422016
|
||||
//line templates/readers.qtpl:72
|
||||
//line templates/readers.qtpl:74
|
||||
}
|
||||
|
81
views/hypha.qtpl
Normal file
81
views/hypha.qtpl
Normal file
@ -0,0 +1,81 @@
|
||||
{% import "path/filepath" %}
|
||||
{% import "strings" %}
|
||||
{% import "github.com/bouncepaw/mycorrhiza/hyphae" %}
|
||||
{% import "github.com/bouncepaw/mycorrhiza/util" %}
|
||||
|
||||
{% func NaviTitleHTML(h *hyphae.Hypha) %}
|
||||
{% code
|
||||
var (
|
||||
prevAcc = "/hypha/"
|
||||
parts = strings.Split(h.Name, "/")
|
||||
)
|
||||
%}
|
||||
<h1 class="navi-title">
|
||||
{% stripspace %}
|
||||
<a href="/hypha/{%s util.HomePage %}">
|
||||
{%-s= util.SiteNavIcon -%}
|
||||
<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 BackLinksHTML(h *hyphae.Hypha) %}
|
||||
<aside class="backlinks layout-card">
|
||||
<h2 class="backlinks__title layout-card__title">Backlinks</h2>
|
||||
<nav class="backlinks__nav">
|
||||
<ul class="backlinks__list">
|
||||
{% for _, backlink := range h.BackLinks %}
|
||||
<li class="backlinks__entry">
|
||||
<a class="backlinks__link" href="/hypha/{%s backlink.Name %}">
|
||||
{%s util.BeautifulName(filepath.Base(backlink.Name)) %}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</nav>
|
||||
</aside>
|
||||
{% endfunc %}
|
||||
|
||||
{% func AttachmentHTML(h *hyphae.Hypha) %}
|
||||
{% switch filepath.Ext(h.BinaryPath) %}
|
||||
|
||||
{% case ".jpg", ".gif", ".png", ".webp", ".svg", ".ico" %}
|
||||
<div class="binary-container binary-container_with-img">
|
||||
<a href="/binary/{%s= h.Name %}"><img src="/binary/{%s= h.Name %}"/></a>
|
||||
</div>
|
||||
|
||||
{% case ".ogg", ".webm", ".mp4" %}
|
||||
<div class="binary-container binary-container_with-video">
|
||||
<video controls>
|
||||
<source src="/binary/{%s= h.Name %}"/>
|
||||
<p>Your browser does not support video. <a href="/binary/{%s= h.Name %}">Download video</a></p>
|
||||
</video>
|
||||
</div>
|
||||
|
||||
{% case ".mp3" %}
|
||||
<div class="binary-container binary-container_with-audio">
|
||||
<audio controls>
|
||||
<source src="/binary/{%s= h.Name %}"/>
|
||||
<p>Your browser does not support audio. <a href="/binary/{%s= h.Name %}">Download audio</a></p>
|
||||
</audio>
|
||||
</div>
|
||||
|
||||
{% default %}
|
||||
<div class="binary-container binary-container_with-nothing">
|
||||
<p><a href="/binary/{%s= h.Name %}">Download media</a></p>
|
||||
</div>
|
||||
{% endswitch %}
|
||||
{% endfunc %}
|
297
views/hypha.qtpl.go
Normal file
297
views/hypha.qtpl.go
Normal file
@ -0,0 +1,297 @@
|
||||
// Code generated by qtc from "hypha.qtpl". DO NOT EDIT.
|
||||
// See https://github.com/valyala/quicktemplate for details.
|
||||
|
||||
//line views/hypha.qtpl:1
|
||||
package views
|
||||
|
||||
//line views/hypha.qtpl:1
|
||||
import "path/filepath"
|
||||
|
||||
//line views/hypha.qtpl:2
|
||||
import "strings"
|
||||
|
||||
//line views/hypha.qtpl:3
|
||||
import "github.com/bouncepaw/mycorrhiza/hyphae"
|
||||
|
||||
//line views/hypha.qtpl:4
|
||||
import "github.com/bouncepaw/mycorrhiza/util"
|
||||
|
||||
//line views/hypha.qtpl:6
|
||||
import (
|
||||
qtio422016 "io"
|
||||
|
||||
qt422016 "github.com/valyala/quicktemplate"
|
||||
)
|
||||
|
||||
//line views/hypha.qtpl:6
|
||||
var (
|
||||
_ = qtio422016.Copy
|
||||
_ = qt422016.AcquireByteBuffer
|
||||
)
|
||||
|
||||
//line views/hypha.qtpl:6
|
||||
func StreamNaviTitleHTML(qw422016 *qt422016.Writer, h *hyphae.Hypha) {
|
||||
//line views/hypha.qtpl:6
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line views/hypha.qtpl:8
|
||||
var (
|
||||
prevAcc = "/hypha/"
|
||||
parts = strings.Split(h.Name, "/")
|
||||
)
|
||||
|
||||
//line views/hypha.qtpl:12
|
||||
qw422016.N().S(`
|
||||
<h1 class="navi-title">
|
||||
`)
|
||||
//line views/hypha.qtpl:14
|
||||
qw422016.N().S(`<a href="/hypha/`)
|
||||
//line views/hypha.qtpl:15
|
||||
qw422016.E().S(util.HomePage)
|
||||
//line views/hypha.qtpl:15
|
||||
qw422016.N().S(`">`)
|
||||
//line views/hypha.qtpl:16
|
||||
qw422016.N().S(util.SiteNavIcon)
|
||||
//line views/hypha.qtpl:16
|
||||
qw422016.N().S(`<span aria-hidden="true" class="navi-title__colon">:</span></a>`)
|
||||
//line views/hypha.qtpl:20
|
||||
for i, part := range parts {
|
||||
//line views/hypha.qtpl:21
|
||||
if i > 0 {
|
||||
//line views/hypha.qtpl:21
|
||||
qw422016.N().S(`<span aria-hidden="true" class="navi-title__separator">/</span>`)
|
||||
//line views/hypha.qtpl:23
|
||||
}
|
||||
//line views/hypha.qtpl:23
|
||||
qw422016.N().S(`<a href="`)
|
||||
//line views/hypha.qtpl:25
|
||||
qw422016.E().S(prevAcc + part)
|
||||
//line views/hypha.qtpl:25
|
||||
qw422016.N().S(`"rel="`)
|
||||
//line views/hypha.qtpl:26
|
||||
if i == len(parts)-1 {
|
||||
//line views/hypha.qtpl:26
|
||||
qw422016.N().S(`bookmark`)
|
||||
//line views/hypha.qtpl:26
|
||||
} else {
|
||||
//line views/hypha.qtpl:26
|
||||
qw422016.N().S(`up`)
|
||||
//line views/hypha.qtpl:26
|
||||
}
|
||||
//line views/hypha.qtpl:26
|
||||
qw422016.N().S(`">`)
|
||||
//line views/hypha.qtpl:27
|
||||
qw422016.N().S(util.BeautifulName(part))
|
||||
//line views/hypha.qtpl:27
|
||||
qw422016.N().S(`</a>`)
|
||||
//line views/hypha.qtpl:29
|
||||
prevAcc += part + "/"
|
||||
|
||||
//line views/hypha.qtpl:30
|
||||
}
|
||||
//line views/hypha.qtpl:31
|
||||
qw422016.N().S(`
|
||||
</h1>
|
||||
`)
|
||||
//line views/hypha.qtpl:33
|
||||
}
|
||||
|
||||
//line views/hypha.qtpl:33
|
||||
func WriteNaviTitleHTML(qq422016 qtio422016.Writer, h *hyphae.Hypha) {
|
||||
//line views/hypha.qtpl:33
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line views/hypha.qtpl:33
|
||||
StreamNaviTitleHTML(qw422016, h)
|
||||
//line views/hypha.qtpl:33
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line views/hypha.qtpl:33
|
||||
}
|
||||
|
||||
//line views/hypha.qtpl:33
|
||||
func NaviTitleHTML(h *hyphae.Hypha) string {
|
||||
//line views/hypha.qtpl:33
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line views/hypha.qtpl:33
|
||||
WriteNaviTitleHTML(qb422016, h)
|
||||
//line views/hypha.qtpl:33
|
||||
qs422016 := string(qb422016.B)
|
||||
//line views/hypha.qtpl:33
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line views/hypha.qtpl:33
|
||||
return qs422016
|
||||
//line views/hypha.qtpl:33
|
||||
}
|
||||
|
||||
//line views/hypha.qtpl:35
|
||||
func StreamBackLinksHTML(qw422016 *qt422016.Writer, h *hyphae.Hypha) {
|
||||
//line views/hypha.qtpl:35
|
||||
qw422016.N().S(`
|
||||
<aside class="backlinks layout-card">
|
||||
<h2 class="backlinks__title layout-card__title">Backlinks</h2>
|
||||
<nav class="backlinks__nav">
|
||||
<ul class="backlinks__list">
|
||||
`)
|
||||
//line views/hypha.qtpl:40
|
||||
for _, backlink := range h.BackLinks {
|
||||
//line views/hypha.qtpl:40
|
||||
qw422016.N().S(`
|
||||
<li class="backlinks__entry">
|
||||
<a class="backlinks__link" href="/hypha/`)
|
||||
//line views/hypha.qtpl:42
|
||||
qw422016.E().S(backlink.Name)
|
||||
//line views/hypha.qtpl:42
|
||||
qw422016.N().S(`">
|
||||
`)
|
||||
//line views/hypha.qtpl:43
|
||||
qw422016.E().S(util.BeautifulName(filepath.Base(backlink.Name)))
|
||||
//line views/hypha.qtpl:43
|
||||
qw422016.N().S(`
|
||||
</a>
|
||||
</li>
|
||||
`)
|
||||
//line views/hypha.qtpl:46
|
||||
}
|
||||
//line views/hypha.qtpl:46
|
||||
qw422016.N().S(`
|
||||
</ul>
|
||||
</nav>
|
||||
</aside>
|
||||
`)
|
||||
//line views/hypha.qtpl:50
|
||||
}
|
||||
|
||||
//line views/hypha.qtpl:50
|
||||
func WriteBackLinksHTML(qq422016 qtio422016.Writer, h *hyphae.Hypha) {
|
||||
//line views/hypha.qtpl:50
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line views/hypha.qtpl:50
|
||||
StreamBackLinksHTML(qw422016, h)
|
||||
//line views/hypha.qtpl:50
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line views/hypha.qtpl:50
|
||||
}
|
||||
|
||||
//line views/hypha.qtpl:50
|
||||
func BackLinksHTML(h *hyphae.Hypha) string {
|
||||
//line views/hypha.qtpl:50
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line views/hypha.qtpl:50
|
||||
WriteBackLinksHTML(qb422016, h)
|
||||
//line views/hypha.qtpl:50
|
||||
qs422016 := string(qb422016.B)
|
||||
//line views/hypha.qtpl:50
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line views/hypha.qtpl:50
|
||||
return qs422016
|
||||
//line views/hypha.qtpl:50
|
||||
}
|
||||
|
||||
//line views/hypha.qtpl:52
|
||||
func StreamAttachmentHTML(qw422016 *qt422016.Writer, h *hyphae.Hypha) {
|
||||
//line views/hypha.qtpl:52
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line views/hypha.qtpl:53
|
||||
switch filepath.Ext(h.BinaryPath) {
|
||||
//line views/hypha.qtpl:55
|
||||
case ".jpg", ".gif", ".png", ".webp", ".svg", ".ico":
|
||||
//line views/hypha.qtpl:55
|
||||
qw422016.N().S(`
|
||||
<div class="binary-container binary-container_with-img">
|
||||
<a href="/binary/`)
|
||||
//line views/hypha.qtpl:57
|
||||
qw422016.N().S(h.Name)
|
||||
//line views/hypha.qtpl:57
|
||||
qw422016.N().S(`"><img src="/binary/`)
|
||||
//line views/hypha.qtpl:57
|
||||
qw422016.N().S(h.Name)
|
||||
//line views/hypha.qtpl:57
|
||||
qw422016.N().S(`"/></a>
|
||||
</div>
|
||||
|
||||
`)
|
||||
//line views/hypha.qtpl:60
|
||||
case ".ogg", ".webm", ".mp4":
|
||||
//line views/hypha.qtpl:60
|
||||
qw422016.N().S(`
|
||||
<div class="binary-container binary-container_with-video">
|
||||
<video controls>
|
||||
<source src="/binary/`)
|
||||
//line views/hypha.qtpl:63
|
||||
qw422016.N().S(h.Name)
|
||||
//line views/hypha.qtpl:63
|
||||
qw422016.N().S(`"/>
|
||||
<p>Your browser does not support video. <a href="/binary/`)
|
||||
//line views/hypha.qtpl:64
|
||||
qw422016.N().S(h.Name)
|
||||
//line views/hypha.qtpl:64
|
||||
qw422016.N().S(`">Download video</a></p>
|
||||
</video>
|
||||
</div>
|
||||
|
||||
`)
|
||||
//line views/hypha.qtpl:68
|
||||
case ".mp3":
|
||||
//line views/hypha.qtpl:68
|
||||
qw422016.N().S(`
|
||||
<div class="binary-container binary-container_with-audio">
|
||||
<audio controls>
|
||||
<source src="/binary/`)
|
||||
//line views/hypha.qtpl:71
|
||||
qw422016.N().S(h.Name)
|
||||
//line views/hypha.qtpl:71
|
||||
qw422016.N().S(`"/>
|
||||
<p>Your browser does not support audio. <a href="/binary/`)
|
||||
//line views/hypha.qtpl:72
|
||||
qw422016.N().S(h.Name)
|
||||
//line views/hypha.qtpl:72
|
||||
qw422016.N().S(`">Download audio</a></p>
|
||||
</audio>
|
||||
</div>
|
||||
|
||||
`)
|
||||
//line views/hypha.qtpl:76
|
||||
default:
|
||||
//line views/hypha.qtpl:76
|
||||
qw422016.N().S(`
|
||||
<div class="binary-container binary-container_with-nothing">
|
||||
<p><a href="/binary/`)
|
||||
//line views/hypha.qtpl:78
|
||||
qw422016.N().S(h.Name)
|
||||
//line views/hypha.qtpl:78
|
||||
qw422016.N().S(`">Download media</a></p>
|
||||
</div>
|
||||
`)
|
||||
//line views/hypha.qtpl:80
|
||||
}
|
||||
//line views/hypha.qtpl:80
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line views/hypha.qtpl:81
|
||||
}
|
||||
|
||||
//line views/hypha.qtpl:81
|
||||
func WriteAttachmentHTML(qq422016 qtio422016.Writer, h *hyphae.Hypha) {
|
||||
//line views/hypha.qtpl:81
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line views/hypha.qtpl:81
|
||||
StreamAttachmentHTML(qw422016, h)
|
||||
//line views/hypha.qtpl:81
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line views/hypha.qtpl:81
|
||||
}
|
||||
|
||||
//line views/hypha.qtpl:81
|
||||
func AttachmentHTML(h *hyphae.Hypha) string {
|
||||
//line views/hypha.qtpl:81
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line views/hypha.qtpl:81
|
||||
WriteAttachmentHTML(qb422016, h)
|
||||
//line views/hypha.qtpl:81
|
||||
qs422016 := string(qb422016.B)
|
||||
//line views/hypha.qtpl:81
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line views/hypha.qtpl:81
|
||||
return qs422016
|
||||
//line views/hypha.qtpl:81
|
||||
}
|
Loading…
Reference in New Issue
Block a user