This commit is contained in:
parent
f4f647acdd
commit
3755e42a75
12
backref.go
12
backref.go
|
@ -6,8 +6,6 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"gitlab.com/golang-commonmark/markdown"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Reference struct {
|
type Reference struct {
|
||||||
|
@ -85,21 +83,19 @@ func loadBackrefs(fp *FilePages, p string) (map[string][]Backref, error) {
|
||||||
|
|
||||||
result := make(map[string][]Backref)
|
result := make(map[string][]Backref)
|
||||||
|
|
||||||
md := markdown.New(
|
|
||||||
markdown.HTML(true),
|
|
||||||
markdown.XHTMLOutput(true),
|
|
||||||
)
|
|
||||||
|
|
||||||
for _, ref := range refs[p] {
|
for _, ref := range refs[p] {
|
||||||
title := strings.Replace(ref.Name, "_", " ", -1)
|
title := strings.Replace(ref.Name, "_", " ", -1)
|
||||||
if _, e := result[ref.Name]; !e {
|
if _, e := result[ref.Name]; !e {
|
||||||
result[ref.Name] = nil
|
result[ref.Name] = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
links := renderLinks(strings.TrimLeft(ref.Link.Line, " *"))
|
||||||
|
pageText := renderMarkdown2(links)
|
||||||
|
|
||||||
result[ref.Name] = append(result[ref.Name], Backref{
|
result[ref.Name] = append(result[ref.Name], Backref{
|
||||||
Name: ref.Name,
|
Name: ref.Name,
|
||||||
Title: title,
|
Title: title,
|
||||||
Line: template.HTML(md.RenderToString([]byte(renderLinks(strings.TrimLeft(ref.Link.Line, " *"))))),
|
Line: template.HTML(pageText),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
7
main.go
7
main.go
|
@ -13,7 +13,6 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitlab.com/golang-commonmark/markdown"
|
|
||||||
"p83.nl/go/ekster/pkg/util"
|
"p83.nl/go/ekster/pkg/util"
|
||||||
"p83.nl/go/indieauth"
|
"p83.nl/go/indieauth"
|
||||||
)
|
)
|
||||||
|
@ -482,11 +481,7 @@ func (h *indexHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
pageText = renderLinks(pageText)
|
pageText = renderLinks(pageText)
|
||||||
|
|
||||||
md := markdown.New(
|
pageText = renderMarkdown2(pageText)
|
||||||
markdown.HTML(true),
|
|
||||||
markdown.XHTMLOutput(true),
|
|
||||||
)
|
|
||||||
pageText = md.RenderToString([]byte(pageText))
|
|
||||||
|
|
||||||
pageBase := getPageBase()
|
pageBase := getPageBase()
|
||||||
data := indexPage{
|
data := indexPage{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user