mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2025-01-07 02:10:26 +00:00
Backlinks: Isolate
This commit is contained in:
parent
75ded17a03
commit
2dcb1a5fe7
@ -9,8 +9,8 @@ import (
|
|||||||
"github.com/bouncepaw/mycorrhiza/util"
|
"github.com/bouncepaw/mycorrhiza/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
// YieldHyphaBacklinks gets backlinks for the desired hypha, sorts and yields them one by one.
|
// yieldHyphaBacklinks gets backlinks for the desired hypha, sorts and yields them one by one.
|
||||||
func YieldHyphaBacklinks(hyphaName string) <-chan string {
|
func yieldHyphaBacklinks(hyphaName string) <-chan string {
|
||||||
hyphaName = util.CanonicalName(hyphaName)
|
hyphaName = util.CanonicalName(hyphaName)
|
||||||
out := make(chan string)
|
out := make(chan string)
|
||||||
sorted := hyphae.PathographicSort(out)
|
sorted := hyphae.PathographicSort(out)
|
||||||
@ -147,7 +147,7 @@ type backlinkIndexRenaming struct {
|
|||||||
links []string
|
links []string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply changes backlink index respective to the operation data
|
// apply changes backlink index respective to the operation data
|
||||||
func (op backlinkIndexRenaming) apply() {
|
func (op backlinkIndexRenaming) apply() {
|
||||||
for _, link := range op.links {
|
for _, link := range op.links {
|
||||||
if lSet, exists := backlinkIndex[link]; exists {
|
if lSet, exists := backlinkIndex[link]; exists {
|
17
backlinks/view_backlinks.html
Normal file
17
backlinks/view_backlinks.html
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{{define "backlinks to text"}}Backlinks to {{.}}{{end}}
|
||||||
|
{{define "title"}}{{template "backlinks to text" .HyphaName}}{{end}}
|
||||||
|
{{define "body"}}
|
||||||
|
<div class="layout">
|
||||||
|
<main class="main-width backlinks">
|
||||||
|
<h1>{{block "backlinks to link" .HyphaName}}Backlinks to <a href="/hypha/{{.}}">{{beautifulName .}}</a>{{end}}</h1>
|
||||||
|
<p>{{block "description" .}}Hyphae which have a link to this hypha, embed it as an image or transclude it are listed below.{{end}}</p>
|
||||||
|
<ul class="backlinks__list">
|
||||||
|
{{range .Backlinks}}
|
||||||
|
<li class="backlinks__entry">
|
||||||
|
<a class="backlinks__link wikilink" href="/hypha/{{.}}">{{beautifulName .}}</a>
|
||||||
|
</li>
|
||||||
|
{{end}}
|
||||||
|
</ul>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
{{end}}
|
62
backlinks/web.go
Normal file
62
backlinks/web.go
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
package backlinks
|
||||||
|
|
||||||
|
import (
|
||||||
|
"embed"
|
||||||
|
"github.com/bouncepaw/mycorrhiza/cfg"
|
||||||
|
"github.com/bouncepaw/mycorrhiza/util"
|
||||||
|
"github.com/bouncepaw/mycorrhiza/viewutil"
|
||||||
|
"github.com/gorilla/mux"
|
||||||
|
"log"
|
||||||
|
"net/http"
|
||||||
|
"text/template"
|
||||||
|
)
|
||||||
|
|
||||||
|
func InitHandlers(rtr *mux.Router) {
|
||||||
|
rtr.PathPrefix("/backlinks/").HandlerFunc(handlerBacklinks)
|
||||||
|
chain = viewutil.
|
||||||
|
En(viewutil.CopyEnWith(fs, "view_backlinks.html")).
|
||||||
|
Ru(template.Must(viewutil.CopyRuWith(fs, "view_backlinks.html").Parse(ruTranslation)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// handlerBacklinks lists all backlinks to a hypha.
|
||||||
|
func handlerBacklinks(w http.ResponseWriter, rq *http.Request) {
|
||||||
|
var (
|
||||||
|
hyphaName = util.HyphaNameFromRq(rq, "backlinks")
|
||||||
|
backlinks []string
|
||||||
|
)
|
||||||
|
for b := range yieldHyphaBacklinks(hyphaName) {
|
||||||
|
backlinks = append(backlinks, b)
|
||||||
|
}
|
||||||
|
viewBacklinks(viewutil.MetaFrom(w, rq), hyphaName, backlinks)
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
//go:embed *.html
|
||||||
|
fs embed.FS
|
||||||
|
ruTranslation = `
|
||||||
|
{{define "backlinks to text"}}Обратные ссылки на {{.}}{{end}}
|
||||||
|
{{define "backlinks to link"}}Обратные ссылки на <a href="/hypha/{{.}}">{{beautifulName .}}</a>{{end}}
|
||||||
|
{{define "description"}}Ниже перечислены гифы, на которых есть ссылка на эту гифу, трансклюзия этой гифы или эта гифа вставлена как изображение.{{end}}
|
||||||
|
`
|
||||||
|
chain viewutil.Chain
|
||||||
|
)
|
||||||
|
|
||||||
|
type backlinksData struct {
|
||||||
|
viewutil.BaseData
|
||||||
|
HyphaName string
|
||||||
|
Backlinks []string
|
||||||
|
}
|
||||||
|
|
||||||
|
func viewBacklinks(meta viewutil.Meta, hyphaName string, backlinks []string) {
|
||||||
|
if err := chain.Get(meta).ExecuteTemplate(meta.W, "page", backlinksData{
|
||||||
|
BaseData: viewutil.BaseData{
|
||||||
|
Meta: meta,
|
||||||
|
HeaderLinks: cfg.HeaderLinks,
|
||||||
|
CommonScripts: cfg.CommonScripts,
|
||||||
|
},
|
||||||
|
HyphaName: hyphaName,
|
||||||
|
Backlinks: backlinks,
|
||||||
|
}); err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
}
|
||||||
|
}
|
@ -4,10 +4,6 @@
|
|||||||
"title_search": "Search by title",
|
"title_search": "Search by title",
|
||||||
"admin_panel": "Admin panel",
|
"admin_panel": "Admin panel",
|
||||||
|
|
||||||
"backlinks_title": "Backlinks to {{.hypha_name}}",
|
|
||||||
"backlinks_heading": "Backlinks to {{.hypha_link}}",
|
|
||||||
"backlinks_desc": "Hyphae which have a link to this hypha, embed it as an image or transclude it are listed below.",
|
|
||||||
|
|
||||||
"edit_link": "Edit text",
|
"edit_link": "Edit text",
|
||||||
"logout_link": "Log out",
|
"logout_link": "Log out",
|
||||||
"history_link": "View history",
|
"history_link": "View history",
|
||||||
|
@ -118,7 +118,7 @@ func (t Localizer) GetWithLocale(locale, key string, replacements ...*Replacemen
|
|||||||
|
|
||||||
// If the str doesn't have any substitutions, no need to
|
// If the str doesn't have any substitutions, no need to
|
||||||
// template.Execute.
|
// template.Execute.
|
||||||
if strings.Contains(str, "}}") {
|
if !strings.Contains(str, "}}") {
|
||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,7 +145,7 @@ func (t Localizer) GetPlural(key string, n int, replacements ...*Replacements) s
|
|||||||
|
|
||||||
// As in the original, we skip templating if have nothing to replace
|
// As in the original, we skip templating if have nothing to replace
|
||||||
// (however, it's strange case for plurals)
|
// (however, it's strange case for plurals)
|
||||||
if strings.Contains(str, "}}") {
|
if !strings.Contains(str, "}}") {
|
||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ func (t Localizer) GetPlural64(key string, n int64, replacements ...*Replacement
|
|||||||
|
|
||||||
// As in the original, we skip templating if have nothing to replace
|
// As in the original, we skip templating if have nothing to replace
|
||||||
// (however, it's strange case for plurals)
|
// (however, it's strange case for plurals)
|
||||||
if strings.Contains(str, "}}") {
|
if !strings.Contains(str, "}}") {
|
||||||
return str
|
return str
|
||||||
}
|
}
|
||||||
|
|
||||||
|
3
main.go
3
main.go
@ -5,14 +5,13 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/bouncepaw/mycorrhiza/backlinks"
|
||||||
"github.com/bouncepaw/mycorrhiza/categories"
|
"github.com/bouncepaw/mycorrhiza/categories"
|
||||||
"github.com/bouncepaw/mycorrhiza/migration"
|
"github.com/bouncepaw/mycorrhiza/migration"
|
||||||
"github.com/bouncepaw/mycorrhiza/viewutil"
|
"github.com/bouncepaw/mycorrhiza/viewutil"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/bouncepaw/mycorrhiza/hyphae/backlinks"
|
|
||||||
|
|
||||||
"github.com/bouncepaw/mycorrhiza/cfg"
|
"github.com/bouncepaw/mycorrhiza/cfg"
|
||||||
"github.com/bouncepaw/mycorrhiza/files"
|
"github.com/bouncepaw/mycorrhiza/files"
|
||||||
"github.com/bouncepaw/mycorrhiza/history"
|
"github.com/bouncepaw/mycorrhiza/history"
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
package misc
|
package misc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/bouncepaw/mycorrhiza/backlinks"
|
||||||
"github.com/bouncepaw/mycorrhiza/cfg"
|
"github.com/bouncepaw/mycorrhiza/cfg"
|
||||||
"github.com/bouncepaw/mycorrhiza/files"
|
"github.com/bouncepaw/mycorrhiza/files"
|
||||||
"github.com/bouncepaw/mycorrhiza/hyphae"
|
"github.com/bouncepaw/mycorrhiza/hyphae"
|
||||||
"github.com/bouncepaw/mycorrhiza/hyphae/backlinks"
|
|
||||||
"github.com/bouncepaw/mycorrhiza/l18n"
|
"github.com/bouncepaw/mycorrhiza/l18n"
|
||||||
"github.com/bouncepaw/mycorrhiza/shroom"
|
"github.com/bouncepaw/mycorrhiza/shroom"
|
||||||
"github.com/bouncepaw/mycorrhiza/static"
|
"github.com/bouncepaw/mycorrhiza/static"
|
||||||
|
@ -2,8 +2,7 @@ package shroom
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/bouncepaw/mycorrhiza/hyphae/backlinks"
|
"github.com/bouncepaw/mycorrhiza/backlinks"
|
||||||
|
|
||||||
"github.com/bouncepaw/mycorrhiza/history"
|
"github.com/bouncepaw/mycorrhiza/history"
|
||||||
"github.com/bouncepaw/mycorrhiza/hyphae"
|
"github.com/bouncepaw/mycorrhiza/hyphae"
|
||||||
"github.com/bouncepaw/mycorrhiza/user"
|
"github.com/bouncepaw/mycorrhiza/user"
|
||||||
|
@ -3,7 +3,7 @@ package shroom
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/bouncepaw/mycorrhiza/hyphae/backlinks"
|
"github.com/bouncepaw/mycorrhiza/backlinks"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
|
||||||
"github.com/bouncepaw/mycorrhiza/history"
|
"github.com/bouncepaw/mycorrhiza/history"
|
||||||
|
@ -4,10 +4,10 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/bouncepaw/mycorrhiza/backlinks"
|
||||||
"github.com/bouncepaw/mycorrhiza/files"
|
"github.com/bouncepaw/mycorrhiza/files"
|
||||||
"github.com/bouncepaw/mycorrhiza/history"
|
"github.com/bouncepaw/mycorrhiza/history"
|
||||||
"github.com/bouncepaw/mycorrhiza/hyphae"
|
"github.com/bouncepaw/mycorrhiza/hyphae"
|
||||||
"github.com/bouncepaw/mycorrhiza/hyphae/backlinks"
|
|
||||||
"github.com/bouncepaw/mycorrhiza/mimetype"
|
"github.com/bouncepaw/mycorrhiza/mimetype"
|
||||||
"github.com/bouncepaw/mycorrhiza/user"
|
"github.com/bouncepaw/mycorrhiza/user"
|
||||||
"io"
|
"io"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{% import "strings" %}
|
{% import "strings" %}
|
||||||
{% import "github.com/bouncepaw/mycorrhiza/cfg" %}
|
{% import "github.com/bouncepaw/mycorrhiza/cfg" %}
|
||||||
{% import "github.com/bouncepaw/mycorrhiza/hyphae/backlinks" %}
|
{% import "github.com/bouncepaw/mycorrhiza/backlinks" %}
|
||||||
{% import "github.com/bouncepaw/mycorrhiza/l18n" %}
|
{% import "github.com/bouncepaw/mycorrhiza/l18n" %}
|
||||||
{% import "github.com/bouncepaw/mycorrhiza/user" %}
|
{% import "github.com/bouncepaw/mycorrhiza/user" %}
|
||||||
{% import "github.com/bouncepaw/mycorrhiza/hyphae" %}
|
{% import "github.com/bouncepaw/mycorrhiza/hyphae" %}
|
||||||
|
@ -11,7 +11,7 @@ import "strings"
|
|||||||
import "github.com/bouncepaw/mycorrhiza/cfg"
|
import "github.com/bouncepaw/mycorrhiza/cfg"
|
||||||
|
|
||||||
//line views/nav.qtpl:3
|
//line views/nav.qtpl:3
|
||||||
import "github.com/bouncepaw/mycorrhiza/hyphae/backlinks"
|
import "github.com/bouncepaw/mycorrhiza/backlinks"
|
||||||
|
|
||||||
//line views/nav.qtpl:4
|
//line views/nav.qtpl:4
|
||||||
import "github.com/bouncepaw/mycorrhiza/l18n"
|
import "github.com/bouncepaw/mycorrhiza/l18n"
|
||||||
|
@ -1,34 +1,6 @@
|
|||||||
{% import "fmt" %}
|
|
||||||
|
|
||||||
{% import "github.com/bouncepaw/mycorrhiza/cfg" %}
|
{% import "github.com/bouncepaw/mycorrhiza/cfg" %}
|
||||||
{% import "github.com/bouncepaw/mycorrhiza/util" %}
|
|
||||||
{% import "github.com/bouncepaw/mycorrhiza/l18n" %}
|
{% import "github.com/bouncepaw/mycorrhiza/l18n" %}
|
||||||
|
|
||||||
{% func Backlinks(hyphaName string, generator func(string) <-chan string, lc *l18n.Localizer) %}
|
|
||||||
<div class="layout">
|
|
||||||
<main class="main-width backlinks">
|
|
||||||
<h1>{%s= lc.Get(
|
|
||||||
"ui.backlinks_heading",
|
|
||||||
&l18n.Replacements{
|
|
||||||
"hypha_link": fmt.Sprintf(
|
|
||||||
`<a href="/hypha/%s">%s</a>`,
|
|
||||||
hyphaName,
|
|
||||||
util.BeautifulName(hyphaName),
|
|
||||||
),
|
|
||||||
},
|
|
||||||
)%}</h1>
|
|
||||||
<p>{%s lc.Get("ui.backlinks_desc")%}</p>
|
|
||||||
<ul class="backlinks__list">
|
|
||||||
{% for hyphaName := range generator(hyphaName) %}
|
|
||||||
<li class="backlinks__entry">
|
|
||||||
<a class="backlinks__link wikilink" href="/hypha/{%s hyphaName %}">{%s util.BeautifulName(hyphaName) %}</a>
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
</main>
|
|
||||||
</div>
|
|
||||||
{% endfunc %}
|
|
||||||
|
|
||||||
{% func Help(content, lang string, lc *l18n.Localizer) %}
|
{% func Help(content, lang string, lc *l18n.Localizer) %}
|
||||||
<div class="layout">
|
<div class="layout">
|
||||||
<main class="main-width help">
|
<main class="main-width help">
|
||||||
|
@ -5,262 +5,176 @@
|
|||||||
package views
|
package views
|
||||||
|
|
||||||
//line views/stuff.qtpl:1
|
//line views/stuff.qtpl:1
|
||||||
import "fmt"
|
|
||||||
|
|
||||||
//line views/stuff.qtpl:3
|
|
||||||
import "github.com/bouncepaw/mycorrhiza/cfg"
|
import "github.com/bouncepaw/mycorrhiza/cfg"
|
||||||
|
|
||||||
//line views/stuff.qtpl:4
|
//line views/stuff.qtpl:2
|
||||||
import "github.com/bouncepaw/mycorrhiza/util"
|
|
||||||
|
|
||||||
//line views/stuff.qtpl:5
|
|
||||||
import "github.com/bouncepaw/mycorrhiza/l18n"
|
import "github.com/bouncepaw/mycorrhiza/l18n"
|
||||||
|
|
||||||
//line views/stuff.qtpl:7
|
//line views/stuff.qtpl:4
|
||||||
import (
|
import (
|
||||||
qtio422016 "io"
|
qtio422016 "io"
|
||||||
|
|
||||||
qt422016 "github.com/valyala/quicktemplate"
|
qt422016 "github.com/valyala/quicktemplate"
|
||||||
)
|
)
|
||||||
|
|
||||||
//line views/stuff.qtpl:7
|
//line views/stuff.qtpl:4
|
||||||
var (
|
var (
|
||||||
_ = qtio422016.Copy
|
_ = qtio422016.Copy
|
||||||
_ = qt422016.AcquireByteBuffer
|
_ = qt422016.AcquireByteBuffer
|
||||||
)
|
)
|
||||||
|
|
||||||
//line views/stuff.qtpl:7
|
//line views/stuff.qtpl:4
|
||||||
func StreamBacklinks(qw422016 *qt422016.Writer, hyphaName string, generator func(string) <-chan string, lc *l18n.Localizer) {
|
|
||||||
//line views/stuff.qtpl:7
|
|
||||||
qw422016.N().S(`
|
|
||||||
<div class="layout">
|
|
||||||
<main class="main-width backlinks">
|
|
||||||
<h1>`)
|
|
||||||
//line views/stuff.qtpl:10
|
|
||||||
qw422016.N().S(lc.Get(
|
|
||||||
"ui.backlinks_heading",
|
|
||||||
&l18n.Replacements{
|
|
||||||
"hypha_link": fmt.Sprintf(
|
|
||||||
`<a href="/hypha/%s">%s</a>`,
|
|
||||||
hyphaName,
|
|
||||||
util.BeautifulName(hyphaName),
|
|
||||||
),
|
|
||||||
},
|
|
||||||
))
|
|
||||||
//line views/stuff.qtpl:19
|
|
||||||
qw422016.N().S(`</h1>
|
|
||||||
<p>`)
|
|
||||||
//line views/stuff.qtpl:20
|
|
||||||
qw422016.E().S(lc.Get("ui.backlinks_desc"))
|
|
||||||
//line views/stuff.qtpl:20
|
|
||||||
qw422016.N().S(`</p>
|
|
||||||
<ul class="backlinks__list">
|
|
||||||
`)
|
|
||||||
//line views/stuff.qtpl:22
|
|
||||||
for hyphaName := range generator(hyphaName) {
|
|
||||||
//line views/stuff.qtpl:22
|
|
||||||
qw422016.N().S(`
|
|
||||||
<li class="backlinks__entry">
|
|
||||||
<a class="backlinks__link wikilink" href="/hypha/`)
|
|
||||||
//line views/stuff.qtpl:24
|
|
||||||
qw422016.E().S(hyphaName)
|
|
||||||
//line views/stuff.qtpl:24
|
|
||||||
qw422016.N().S(`">`)
|
|
||||||
//line views/stuff.qtpl:24
|
|
||||||
qw422016.E().S(util.BeautifulName(hyphaName))
|
|
||||||
//line views/stuff.qtpl:24
|
|
||||||
qw422016.N().S(`</a>
|
|
||||||
</li>
|
|
||||||
`)
|
|
||||||
//line views/stuff.qtpl:26
|
|
||||||
}
|
|
||||||
//line views/stuff.qtpl:26
|
|
||||||
qw422016.N().S(`
|
|
||||||
</ul>
|
|
||||||
</main>
|
|
||||||
</div>
|
|
||||||
`)
|
|
||||||
//line views/stuff.qtpl:30
|
|
||||||
}
|
|
||||||
|
|
||||||
//line views/stuff.qtpl:30
|
|
||||||
func WriteBacklinks(qq422016 qtio422016.Writer, hyphaName string, generator func(string) <-chan string, lc *l18n.Localizer) {
|
|
||||||
//line views/stuff.qtpl:30
|
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
|
||||||
//line views/stuff.qtpl:30
|
|
||||||
StreamBacklinks(qw422016, hyphaName, generator, lc)
|
|
||||||
//line views/stuff.qtpl:30
|
|
||||||
qt422016.ReleaseWriter(qw422016)
|
|
||||||
//line views/stuff.qtpl:30
|
|
||||||
}
|
|
||||||
|
|
||||||
//line views/stuff.qtpl:30
|
|
||||||
func Backlinks(hyphaName string, generator func(string) <-chan string, lc *l18n.Localizer) string {
|
|
||||||
//line views/stuff.qtpl:30
|
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
|
||||||
//line views/stuff.qtpl:30
|
|
||||||
WriteBacklinks(qb422016, hyphaName, generator, lc)
|
|
||||||
//line views/stuff.qtpl:30
|
|
||||||
qs422016 := string(qb422016.B)
|
|
||||||
//line views/stuff.qtpl:30
|
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
|
||||||
//line views/stuff.qtpl:30
|
|
||||||
return qs422016
|
|
||||||
//line views/stuff.qtpl:30
|
|
||||||
}
|
|
||||||
|
|
||||||
//line views/stuff.qtpl:32
|
|
||||||
func StreamHelp(qw422016 *qt422016.Writer, content, lang string, lc *l18n.Localizer) {
|
func StreamHelp(qw422016 *qt422016.Writer, content, lang string, lc *l18n.Localizer) {
|
||||||
//line views/stuff.qtpl:32
|
//line views/stuff.qtpl:4
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<div class="layout">
|
<div class="layout">
|
||||||
<main class="main-width help">
|
<main class="main-width help">
|
||||||
<article>
|
<article>
|
||||||
`)
|
`)
|
||||||
//line views/stuff.qtpl:36
|
//line views/stuff.qtpl:8
|
||||||
qw422016.N().S(content)
|
qw422016.N().S(content)
|
||||||
//line views/stuff.qtpl:36
|
//line views/stuff.qtpl:8
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
</article>
|
</article>
|
||||||
</main>
|
</main>
|
||||||
`)
|
`)
|
||||||
//line views/stuff.qtpl:39
|
//line views/stuff.qtpl:11
|
||||||
qw422016.N().S(helpTopics(lang, lc))
|
qw422016.N().S(helpTopics(lang, lc))
|
||||||
//line views/stuff.qtpl:39
|
//line views/stuff.qtpl:11
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
</div>
|
</div>
|
||||||
`)
|
`)
|
||||||
//line views/stuff.qtpl:41
|
//line views/stuff.qtpl:13
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/stuff.qtpl:41
|
//line views/stuff.qtpl:13
|
||||||
func WriteHelp(qq422016 qtio422016.Writer, content, lang string, lc *l18n.Localizer) {
|
func WriteHelp(qq422016 qtio422016.Writer, content, lang string, lc *l18n.Localizer) {
|
||||||
//line views/stuff.qtpl:41
|
//line views/stuff.qtpl:13
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line views/stuff.qtpl:41
|
//line views/stuff.qtpl:13
|
||||||
StreamHelp(qw422016, content, lang, lc)
|
StreamHelp(qw422016, content, lang, lc)
|
||||||
//line views/stuff.qtpl:41
|
//line views/stuff.qtpl:13
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line views/stuff.qtpl:41
|
//line views/stuff.qtpl:13
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/stuff.qtpl:41
|
//line views/stuff.qtpl:13
|
||||||
func Help(content, lang string, lc *l18n.Localizer) string {
|
func Help(content, lang string, lc *l18n.Localizer) string {
|
||||||
//line views/stuff.qtpl:41
|
//line views/stuff.qtpl:13
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line views/stuff.qtpl:41
|
//line views/stuff.qtpl:13
|
||||||
WriteHelp(qb422016, content, lang, lc)
|
WriteHelp(qb422016, content, lang, lc)
|
||||||
//line views/stuff.qtpl:41
|
//line views/stuff.qtpl:13
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line views/stuff.qtpl:41
|
//line views/stuff.qtpl:13
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
//line views/stuff.qtpl:41
|
//line views/stuff.qtpl:13
|
||||||
return qs422016
|
return qs422016
|
||||||
//line views/stuff.qtpl:41
|
//line views/stuff.qtpl:13
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/stuff.qtpl:43
|
//line views/stuff.qtpl:15
|
||||||
func StreamHelpEmptyError(qw422016 *qt422016.Writer, lc *l18n.Localizer) {
|
func StreamHelpEmptyError(qw422016 *qt422016.Writer, lc *l18n.Localizer) {
|
||||||
//line views/stuff.qtpl:43
|
//line views/stuff.qtpl:15
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<h1>`)
|
<h1>`)
|
||||||
//line views/stuff.qtpl:44
|
//line views/stuff.qtpl:16
|
||||||
qw422016.E().S(lc.Get("help.empty_error_title"))
|
qw422016.E().S(lc.Get("help.empty_error_title"))
|
||||||
//line views/stuff.qtpl:44
|
//line views/stuff.qtpl:16
|
||||||
qw422016.N().S(`</h1>
|
qw422016.N().S(`</h1>
|
||||||
<p>`)
|
<p>`)
|
||||||
//line views/stuff.qtpl:45
|
//line views/stuff.qtpl:17
|
||||||
qw422016.E().S(lc.Get("help.empty_error_line_1"))
|
qw422016.E().S(lc.Get("help.empty_error_line_1"))
|
||||||
//line views/stuff.qtpl:45
|
//line views/stuff.qtpl:17
|
||||||
qw422016.N().S(`</p>
|
qw422016.N().S(`</p>
|
||||||
<p>`)
|
<p>`)
|
||||||
//line views/stuff.qtpl:46
|
//line views/stuff.qtpl:18
|
||||||
qw422016.E().S(lc.Get("help.empty_error_line_2a"))
|
qw422016.E().S(lc.Get("help.empty_error_line_2a"))
|
||||||
//line views/stuff.qtpl:46
|
//line views/stuff.qtpl:18
|
||||||
qw422016.N().S(` <a class="wikilink wikilink_external wikilink_https" href="https://github.com/bouncepaw/mycorrhiza">`)
|
qw422016.N().S(` <a class="wikilink wikilink_external wikilink_https" href="https://github.com/bouncepaw/mycorrhiza">`)
|
||||||
//line views/stuff.qtpl:46
|
//line views/stuff.qtpl:18
|
||||||
qw422016.E().S(lc.Get("help.empty_error_link"))
|
qw422016.E().S(lc.Get("help.empty_error_link"))
|
||||||
//line views/stuff.qtpl:46
|
//line views/stuff.qtpl:18
|
||||||
qw422016.N().S(`</a> `)
|
qw422016.N().S(`</a> `)
|
||||||
//line views/stuff.qtpl:46
|
//line views/stuff.qtpl:18
|
||||||
qw422016.E().S(lc.Get("help.empty_error_line_2b"))
|
qw422016.E().S(lc.Get("help.empty_error_line_2b"))
|
||||||
//line views/stuff.qtpl:46
|
//line views/stuff.qtpl:18
|
||||||
qw422016.N().S(`</p>
|
qw422016.N().S(`</p>
|
||||||
`)
|
`)
|
||||||
//line views/stuff.qtpl:47
|
//line views/stuff.qtpl:19
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/stuff.qtpl:47
|
//line views/stuff.qtpl:19
|
||||||
func WriteHelpEmptyError(qq422016 qtio422016.Writer, lc *l18n.Localizer) {
|
func WriteHelpEmptyError(qq422016 qtio422016.Writer, lc *l18n.Localizer) {
|
||||||
//line views/stuff.qtpl:47
|
//line views/stuff.qtpl:19
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line views/stuff.qtpl:47
|
//line views/stuff.qtpl:19
|
||||||
StreamHelpEmptyError(qw422016, lc)
|
StreamHelpEmptyError(qw422016, lc)
|
||||||
//line views/stuff.qtpl:47
|
//line views/stuff.qtpl:19
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line views/stuff.qtpl:47
|
//line views/stuff.qtpl:19
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/stuff.qtpl:47
|
//line views/stuff.qtpl:19
|
||||||
func HelpEmptyError(lc *l18n.Localizer) string {
|
func HelpEmptyError(lc *l18n.Localizer) string {
|
||||||
//line views/stuff.qtpl:47
|
//line views/stuff.qtpl:19
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line views/stuff.qtpl:47
|
//line views/stuff.qtpl:19
|
||||||
WriteHelpEmptyError(qb422016, lc)
|
WriteHelpEmptyError(qb422016, lc)
|
||||||
//line views/stuff.qtpl:47
|
//line views/stuff.qtpl:19
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line views/stuff.qtpl:47
|
//line views/stuff.qtpl:19
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
//line views/stuff.qtpl:47
|
//line views/stuff.qtpl:19
|
||||||
return qs422016
|
return qs422016
|
||||||
//line views/stuff.qtpl:47
|
//line views/stuff.qtpl:19
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/stuff.qtpl:49
|
//line views/stuff.qtpl:21
|
||||||
func streamcommonScripts(qw422016 *qt422016.Writer) {
|
func streamcommonScripts(qw422016 *qt422016.Writer) {
|
||||||
//line views/stuff.qtpl:49
|
//line views/stuff.qtpl:21
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
`)
|
`)
|
||||||
//line views/stuff.qtpl:50
|
//line views/stuff.qtpl:22
|
||||||
for _, scriptPath := range cfg.CommonScripts {
|
for _, scriptPath := range cfg.CommonScripts {
|
||||||
//line views/stuff.qtpl:50
|
//line views/stuff.qtpl:22
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<script src="`)
|
<script src="`)
|
||||||
//line views/stuff.qtpl:51
|
//line views/stuff.qtpl:23
|
||||||
qw422016.E().S(scriptPath)
|
qw422016.E().S(scriptPath)
|
||||||
//line views/stuff.qtpl:51
|
//line views/stuff.qtpl:23
|
||||||
qw422016.N().S(`"></script>
|
qw422016.N().S(`"></script>
|
||||||
`)
|
`)
|
||||||
//line views/stuff.qtpl:52
|
//line views/stuff.qtpl:24
|
||||||
}
|
}
|
||||||
//line views/stuff.qtpl:52
|
//line views/stuff.qtpl:24
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
`)
|
`)
|
||||||
//line views/stuff.qtpl:53
|
//line views/stuff.qtpl:25
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/stuff.qtpl:53
|
//line views/stuff.qtpl:25
|
||||||
func writecommonScripts(qq422016 qtio422016.Writer) {
|
func writecommonScripts(qq422016 qtio422016.Writer) {
|
||||||
//line views/stuff.qtpl:53
|
//line views/stuff.qtpl:25
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line views/stuff.qtpl:53
|
//line views/stuff.qtpl:25
|
||||||
streamcommonScripts(qw422016)
|
streamcommonScripts(qw422016)
|
||||||
//line views/stuff.qtpl:53
|
//line views/stuff.qtpl:25
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line views/stuff.qtpl:53
|
//line views/stuff.qtpl:25
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/stuff.qtpl:53
|
//line views/stuff.qtpl:25
|
||||||
func commonScripts() string {
|
func commonScripts() string {
|
||||||
//line views/stuff.qtpl:53
|
//line views/stuff.qtpl:25
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line views/stuff.qtpl:53
|
//line views/stuff.qtpl:25
|
||||||
writecommonScripts(qb422016)
|
writecommonScripts(qb422016)
|
||||||
//line views/stuff.qtpl:53
|
//line views/stuff.qtpl:25
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line views/stuff.qtpl:53
|
//line views/stuff.qtpl:25
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
//line views/stuff.qtpl:53
|
//line views/stuff.qtpl:25
|
||||||
return qs422016
|
return qs422016
|
||||||
//line views/stuff.qtpl:53
|
//line views/stuff.qtpl:25
|
||||||
}
|
}
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
package web
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/bouncepaw/mycorrhiza/hyphae/backlinks"
|
|
||||||
"github.com/bouncepaw/mycorrhiza/viewutil"
|
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
|
||||||
|
|
||||||
"github.com/bouncepaw/mycorrhiza/l18n"
|
|
||||||
"github.com/bouncepaw/mycorrhiza/util"
|
|
||||||
"github.com/bouncepaw/mycorrhiza/views"
|
|
||||||
)
|
|
||||||
|
|
||||||
func initBacklinks(r *mux.Router) {
|
|
||||||
r.PathPrefix("/backlinks/").HandlerFunc(handlerBacklinks)
|
|
||||||
}
|
|
||||||
|
|
||||||
// handlerBacklinks lists all backlinks to a hypha.
|
|
||||||
func handlerBacklinks(w http.ResponseWriter, rq *http.Request) {
|
|
||||||
var (
|
|
||||||
hyphaName = util.HyphaNameFromRq(rq, "backlinks")
|
|
||||||
lc = l18n.FromRequest(rq)
|
|
||||||
)
|
|
||||||
util.HTTP200Page(w, views.Base(
|
|
||||||
viewutil.MetaFrom(w, rq),
|
|
||||||
lc.Get("ui.backlinks_title", &l18n.Replacements{"query": util.BeautifulName(hyphaName)}),
|
|
||||||
views.Backlinks(hyphaName, backlinks.YieldHyphaBacklinks, lc),
|
|
||||||
))
|
|
||||||
}
|
|
@ -2,6 +2,7 @@
|
|||||||
package web
|
package web
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/bouncepaw/mycorrhiza/backlinks"
|
||||||
"github.com/bouncepaw/mycorrhiza/categories"
|
"github.com/bouncepaw/mycorrhiza/categories"
|
||||||
"github.com/bouncepaw/mycorrhiza/misc"
|
"github.com/bouncepaw/mycorrhiza/misc"
|
||||||
"io"
|
"io"
|
||||||
@ -47,7 +48,7 @@ func Handler() http.Handler {
|
|||||||
initMutators(wikiRouter)
|
initMutators(wikiRouter)
|
||||||
initHistory(wikiRouter)
|
initHistory(wikiRouter)
|
||||||
initHelp(wikiRouter)
|
initHelp(wikiRouter)
|
||||||
initBacklinks(wikiRouter)
|
backlinks.InitHandlers(wikiRouter)
|
||||||
categories.InitHandlers(wikiRouter)
|
categories.InitHandlers(wikiRouter)
|
||||||
misc.InitHandlers(wikiRouter)
|
misc.InitHandlers(wikiRouter)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user