mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2024-12-12 05:20:26 +00:00
Make backlink sidebar invisible and make backlink indexer sync
This commit is contained in:
parent
c726a8b307
commit
9f1eadcec4
@ -3,7 +3,6 @@ package shroom
|
|||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"sync"
|
|
||||||
|
|
||||||
"github.com/bouncepaw/mycorrhiza/hyphae"
|
"github.com/bouncepaw/mycorrhiza/hyphae"
|
||||||
"github.com/bouncepaw/mycorrhiza/markup"
|
"github.com/bouncepaw/mycorrhiza/markup"
|
||||||
@ -18,25 +17,19 @@ func FindAllBacklinks() {
|
|||||||
|
|
||||||
func findBacklinkWorker(h *hyphae.Hypha) {
|
func findBacklinkWorker(h *hyphae.Hypha) {
|
||||||
var (
|
var (
|
||||||
wg sync.WaitGroup
|
|
||||||
textContents, err = ioutil.ReadFile(h.TextPath)
|
textContents, err = ioutil.ReadFile(h.TextPath)
|
||||||
)
|
)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
for outlink := range markup.Doc(h.Name, string(textContents)).OutLinks() {
|
for outlink := range markup.Doc(h.Name, string(textContents)).OutLinks() {
|
||||||
go func() {
|
outlinkHypha := hyphae.ByName(outlink)
|
||||||
wg.Add(1)
|
if outlinkHypha == h {
|
||||||
outlinkHypha := hyphae.ByName(outlink)
|
break
|
||||||
if outlinkHypha == h {
|
}
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
outlinkHypha.AddBackLink(h)
|
outlinkHypha.AddBackLink(h)
|
||||||
outlinkHypha.InsertIfNewKeepExistence()
|
outlinkHypha.InsertIfNewKeepExistence()
|
||||||
h.AddOutLink(outlinkHypha)
|
h.AddOutLink(outlinkHypha)
|
||||||
wg.Done()
|
|
||||||
}()
|
|
||||||
}
|
}
|
||||||
wg.Wait()
|
|
||||||
} else {
|
} else {
|
||||||
log.Println("Error when reading text contents of ‘%s’: %s", h.Name, err.Error())
|
log.Println("Error when reading text contents of ‘%s’: %s", h.Name, err.Error())
|
||||||
}
|
}
|
||||||
|
@ -280,7 +280,7 @@ mark { background: rgba(130, 80, 30, 5); color: inherit; }
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.backlinks { display: none; }
|
||||||
`)
|
`)
|
||||||
//line templates/asset.qtpl:2
|
//line templates/asset.qtpl:2
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
|
@ -255,4 +255,4 @@ mark { background: rgba(130, 80, 30, 5); color: inherit; }
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.backlinks { display: none; }
|
||||||
|
Loading…
Reference in New Issue
Block a user