mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2024-10-30 03:36:16 +00:00
Backlinks: Isolate
This commit is contained in:
parent
75ded17a03
commit
2dcb1a5fe7
@ -9,8 +9,8 @@ import (
|
||||
"github.com/bouncepaw/mycorrhiza/util"
|
||||
)
|
||||
|
||||
// YieldHyphaBacklinks gets backlinks for the desired hypha, sorts and yields them one by one.
|
||||
func YieldHyphaBacklinks(hyphaName string) <-chan string {
|
||||
// yieldHyphaBacklinks gets backlinks for the desired hypha, sorts and yields them one by one.
|
||||
func yieldHyphaBacklinks(hyphaName string) <-chan string {
|
||||
hyphaName = util.CanonicalName(hyphaName)
|
||||
out := make(chan string)
|
||||
sorted := hyphae.PathographicSort(out)
|
||||
@ -147,7 +147,7 @@ type backlinkIndexRenaming struct {
|
||||
links []string
|
||||
}
|
||||
|
||||
// Apply changes backlink index respective to the operation data
|
||||
// apply changes backlink index respective to the operation data
|
||||
func (op backlinkIndexRenaming) apply() {
|
||||
for _, link := range op.links {
|
||||
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",
|
||||
"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",
|
||||
"logout_link": "Log out",
|
||||
"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
|
||||
// template.Execute.
|
||||
if strings.Contains(str, "}}") {
|
||||
if !strings.Contains(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
|
||||
// (however, it's strange case for plurals)
|
||||
if strings.Contains(str, "}}") {
|
||||
if !strings.Contains(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
|
||||
// (however, it's strange case for plurals)
|
||||
if strings.Contains(str, "}}") {
|
||||
if !strings.Contains(str, "}}") {
|
||||
return str
|
||||
}
|
||||
|
||||
|
3
main.go
3
main.go
@ -5,14 +5,13 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/bouncepaw/mycorrhiza/backlinks"
|
||||
"github.com/bouncepaw/mycorrhiza/categories"
|
||||
"github.com/bouncepaw/mycorrhiza/migration"
|
||||
"github.com/bouncepaw/mycorrhiza/viewutil"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/bouncepaw/mycorrhiza/hyphae/backlinks"
|
||||
|
||||
"github.com/bouncepaw/mycorrhiza/cfg"
|
||||
"github.com/bouncepaw/mycorrhiza/files"
|
||||
"github.com/bouncepaw/mycorrhiza/history"
|
||||
|
@ -2,10 +2,10 @@
|
||||
package misc
|
||||
|
||||
import (
|
||||
"github.com/bouncepaw/mycorrhiza/backlinks"
|
||||
"github.com/bouncepaw/mycorrhiza/cfg"
|
||||
"github.com/bouncepaw/mycorrhiza/files"
|
||||
"github.com/bouncepaw/mycorrhiza/hyphae"
|
||||
"github.com/bouncepaw/mycorrhiza/hyphae/backlinks"
|
||||
"github.com/bouncepaw/mycorrhiza/l18n"
|
||||
"github.com/bouncepaw/mycorrhiza/shroom"
|
||||
"github.com/bouncepaw/mycorrhiza/static"
|
||||
|
@ -2,8 +2,7 @@ package shroom
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/bouncepaw/mycorrhiza/hyphae/backlinks"
|
||||
|
||||
"github.com/bouncepaw/mycorrhiza/backlinks"
|
||||
"github.com/bouncepaw/mycorrhiza/history"
|
||||
"github.com/bouncepaw/mycorrhiza/hyphae"
|
||||
"github.com/bouncepaw/mycorrhiza/user"
|
||||
|
@ -3,7 +3,7 @@ package shroom
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/bouncepaw/mycorrhiza/hyphae/backlinks"
|
||||
"github.com/bouncepaw/mycorrhiza/backlinks"
|
||||
"regexp"
|
||||
|
||||
"github.com/bouncepaw/mycorrhiza/history"
|
||||
|
@ -4,10 +4,10 @@ import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/bouncepaw/mycorrhiza/backlinks"
|
||||
"github.com/bouncepaw/mycorrhiza/files"
|
||||
"github.com/bouncepaw/mycorrhiza/history"
|
||||
"github.com/bouncepaw/mycorrhiza/hyphae"
|
||||
"github.com/bouncepaw/mycorrhiza/hyphae/backlinks"
|
||||
"github.com/bouncepaw/mycorrhiza/mimetype"
|
||||
"github.com/bouncepaw/mycorrhiza/user"
|
||||
"io"
|
||||
|
@ -1,6 +1,6 @@
|
||||
{% import "strings" %}
|
||||
{% 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/user" %}
|
||||
{% import "github.com/bouncepaw/mycorrhiza/hyphae" %}
|
||||
|
@ -11,7 +11,7 @@ import "strings"
|
||||
import "github.com/bouncepaw/mycorrhiza/cfg"
|
||||
|
||||
//line views/nav.qtpl:3
|
||||
import "github.com/bouncepaw/mycorrhiza/hyphae/backlinks"
|
||||
import "github.com/bouncepaw/mycorrhiza/backlinks"
|
||||
|
||||
//line views/nav.qtpl:4
|
||||
import "github.com/bouncepaw/mycorrhiza/l18n"
|
||||
|
@ -1,34 +1,6 @@
|
||||
{% import "fmt" %}
|
||||
|
||||
{% import "github.com/bouncepaw/mycorrhiza/cfg" %}
|
||||
{% import "github.com/bouncepaw/mycorrhiza/util" %}
|
||||
{% 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) %}
|
||||
<div class="layout">
|
||||
<main class="main-width help">
|
||||
|
@ -5,262 +5,176 @@
|
||||
package views
|
||||
|
||||
//line views/stuff.qtpl:1
|
||||
import "fmt"
|
||||
|
||||
//line views/stuff.qtpl:3
|
||||
import "github.com/bouncepaw/mycorrhiza/cfg"
|
||||
|
||||
//line views/stuff.qtpl:4
|
||||
import "github.com/bouncepaw/mycorrhiza/util"
|
||||
|
||||
//line views/stuff.qtpl:5
|
||||
//line views/stuff.qtpl:2
|
||||
import "github.com/bouncepaw/mycorrhiza/l18n"
|
||||
|
||||
//line views/stuff.qtpl:7
|
||||
//line views/stuff.qtpl:4
|
||||
import (
|
||||
qtio422016 "io"
|
||||
|
||||
qt422016 "github.com/valyala/quicktemplate"
|
||||
)
|
||||
|
||||
//line views/stuff.qtpl:7
|
||||
//line views/stuff.qtpl:4
|
||||
var (
|
||||
_ = qtio422016.Copy
|
||||
_ = qt422016.AcquireByteBuffer
|
||||
)
|
||||
|
||||
//line views/stuff.qtpl:7
|
||||
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
|
||||
//line views/stuff.qtpl:4
|
||||
func StreamHelp(qw422016 *qt422016.Writer, content, lang string, lc *l18n.Localizer) {
|
||||
//line views/stuff.qtpl:32
|
||||
//line views/stuff.qtpl:4
|
||||
qw422016.N().S(`
|
||||
<div class="layout">
|
||||
<main class="main-width help">
|
||||
<article>
|
||||
`)
|
||||
//line views/stuff.qtpl:36
|
||||
//line views/stuff.qtpl:8
|
||||
qw422016.N().S(content)
|
||||
//line views/stuff.qtpl:36
|
||||
//line views/stuff.qtpl:8
|
||||
qw422016.N().S(`
|
||||
</article>
|
||||
</main>
|
||||
`)
|
||||
//line views/stuff.qtpl:39
|
||||
//line views/stuff.qtpl:11
|
||||
qw422016.N().S(helpTopics(lang, lc))
|
||||
//line views/stuff.qtpl:39
|
||||
//line views/stuff.qtpl:11
|
||||
qw422016.N().S(`
|
||||
</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) {
|
||||
//line views/stuff.qtpl:41
|
||||
//line views/stuff.qtpl:13
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line views/stuff.qtpl:41
|
||||
//line views/stuff.qtpl:13
|
||||
StreamHelp(qw422016, content, lang, lc)
|
||||
//line views/stuff.qtpl:41
|
||||
//line views/stuff.qtpl:13
|
||||
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 {
|
||||
//line views/stuff.qtpl:41
|
||||
//line views/stuff.qtpl:13
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line views/stuff.qtpl:41
|
||||
//line views/stuff.qtpl:13
|
||||
WriteHelp(qb422016, content, lang, lc)
|
||||
//line views/stuff.qtpl:41
|
||||
//line views/stuff.qtpl:13
|
||||
qs422016 := string(qb422016.B)
|
||||
//line views/stuff.qtpl:41
|
||||
//line views/stuff.qtpl:13
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line views/stuff.qtpl:41
|
||||
//line views/stuff.qtpl:13
|
||||
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) {
|
||||
//line views/stuff.qtpl:43
|
||||
//line views/stuff.qtpl:15
|
||||
qw422016.N().S(`
|
||||
<h1>`)
|
||||
//line views/stuff.qtpl:44
|
||||
//line views/stuff.qtpl:16
|
||||
qw422016.E().S(lc.Get("help.empty_error_title"))
|
||||
//line views/stuff.qtpl:44
|
||||
//line views/stuff.qtpl:16
|
||||
qw422016.N().S(`</h1>
|
||||
<p>`)
|
||||
//line views/stuff.qtpl:45
|
||||
//line views/stuff.qtpl:17
|
||||
qw422016.E().S(lc.Get("help.empty_error_line_1"))
|
||||
//line views/stuff.qtpl:45
|
||||
//line views/stuff.qtpl:17
|
||||
qw422016.N().S(`</p>
|
||||
<p>`)
|
||||
//line views/stuff.qtpl:46
|
||||
//line views/stuff.qtpl:18
|
||||
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">`)
|
||||
//line views/stuff.qtpl:46
|
||||
//line views/stuff.qtpl:18
|
||||
qw422016.E().S(lc.Get("help.empty_error_link"))
|
||||
//line views/stuff.qtpl:46
|
||||
//line views/stuff.qtpl:18
|
||||
qw422016.N().S(`</a> `)
|
||||
//line views/stuff.qtpl:46
|
||||
//line views/stuff.qtpl:18
|
||||
qw422016.E().S(lc.Get("help.empty_error_line_2b"))
|
||||
//line views/stuff.qtpl:46
|
||||
//line views/stuff.qtpl:18
|
||||
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) {
|
||||
//line views/stuff.qtpl:47
|
||||
//line views/stuff.qtpl:19
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line views/stuff.qtpl:47
|
||||
//line views/stuff.qtpl:19
|
||||
StreamHelpEmptyError(qw422016, lc)
|
||||
//line views/stuff.qtpl:47
|
||||
//line views/stuff.qtpl:19
|
||||
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 {
|
||||
//line views/stuff.qtpl:47
|
||||
//line views/stuff.qtpl:19
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line views/stuff.qtpl:47
|
||||
//line views/stuff.qtpl:19
|
||||
WriteHelpEmptyError(qb422016, lc)
|
||||
//line views/stuff.qtpl:47
|
||||
//line views/stuff.qtpl:19
|
||||
qs422016 := string(qb422016.B)
|
||||
//line views/stuff.qtpl:47
|
||||
//line views/stuff.qtpl:19
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line views/stuff.qtpl:47
|
||||
//line views/stuff.qtpl:19
|
||||
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) {
|
||||
//line views/stuff.qtpl:49
|
||||
//line views/stuff.qtpl:21
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line views/stuff.qtpl:50
|
||||
//line views/stuff.qtpl:22
|
||||
for _, scriptPath := range cfg.CommonScripts {
|
||||
//line views/stuff.qtpl:50
|
||||
//line views/stuff.qtpl:22
|
||||
qw422016.N().S(`
|
||||
<script src="`)
|
||||
//line views/stuff.qtpl:51
|
||||
//line views/stuff.qtpl:23
|
||||
qw422016.E().S(scriptPath)
|
||||
//line views/stuff.qtpl:51
|
||||
//line views/stuff.qtpl:23
|
||||
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(`
|
||||
`)
|
||||
//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) {
|
||||
//line views/stuff.qtpl:53
|
||||
//line views/stuff.qtpl:25
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line views/stuff.qtpl:53
|
||||
//line views/stuff.qtpl:25
|
||||
streamcommonScripts(qw422016)
|
||||
//line views/stuff.qtpl:53
|
||||
//line views/stuff.qtpl:25
|
||||
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 {
|
||||
//line views/stuff.qtpl:53
|
||||
//line views/stuff.qtpl:25
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line views/stuff.qtpl:53
|
||||
//line views/stuff.qtpl:25
|
||||
writecommonScripts(qb422016)
|
||||
//line views/stuff.qtpl:53
|
||||
//line views/stuff.qtpl:25
|
||||
qs422016 := string(qb422016.B)
|
||||
//line views/stuff.qtpl:53
|
||||
//line views/stuff.qtpl:25
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line views/stuff.qtpl:53
|
||||
//line views/stuff.qtpl:25
|
||||
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
|
||||
|
||||
import (
|
||||
"github.com/bouncepaw/mycorrhiza/backlinks"
|
||||
"github.com/bouncepaw/mycorrhiza/categories"
|
||||
"github.com/bouncepaw/mycorrhiza/misc"
|
||||
"io"
|
||||
@ -47,7 +48,7 @@ func Handler() http.Handler {
|
||||
initMutators(wikiRouter)
|
||||
initHistory(wikiRouter)
|
||||
initHelp(wikiRouter)
|
||||
initBacklinks(wikiRouter)
|
||||
backlinks.InitHandlers(wikiRouter)
|
||||
categories.InitHandlers(wikiRouter)
|
||||
misc.InitHandlers(wikiRouter)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user