1
0
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:
bouncepaw 2021-02-20 21:23:47 +05:00
parent c726a8b307
commit 9f1eadcec4
3 changed files with 9 additions and 16 deletions

View File

@ -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() {
wg.Add(1)
outlinkHypha := hyphae.ByName(outlink) outlinkHypha := hyphae.ByName(outlink)
if outlinkHypha == h { if outlinkHypha == h {
return break
} }
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())
} }

View File

@ -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(`

View File

@ -255,4 +255,4 @@ mark { background: rgba(130, 80, 30, 5); color: inherit; }
} }
.backlinks { display: none; }