From 9f1eadcec44e2295850c6130c16efaed6efdd288 Mon Sep 17 00:00:00 2001 From: bouncepaw Date: Sat, 20 Feb 2021 21:23:47 +0500 Subject: [PATCH] Make backlink sidebar invisible and make backlink indexer sync --- shroom/backlink.go | 21 +++++++-------------- templates/asset.qtpl.go | 2 +- templates/default.css | 2 +- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/shroom/backlink.go b/shroom/backlink.go index 8335fc2..860ba56 100644 --- a/shroom/backlink.go +++ b/shroom/backlink.go @@ -3,7 +3,6 @@ package shroom import ( "io/ioutil" "log" - "sync" "github.com/bouncepaw/mycorrhiza/hyphae" "github.com/bouncepaw/mycorrhiza/markup" @@ -18,25 +17,19 @@ func FindAllBacklinks() { func findBacklinkWorker(h *hyphae.Hypha) { var ( - wg sync.WaitGroup textContents, err = ioutil.ReadFile(h.TextPath) ) if err == nil { for outlink := range markup.Doc(h.Name, string(textContents)).OutLinks() { - go func() { - wg.Add(1) - outlinkHypha := hyphae.ByName(outlink) - if outlinkHypha == h { - return - } + outlinkHypha := hyphae.ByName(outlink) + if outlinkHypha == h { + break + } - outlinkHypha.AddBackLink(h) - outlinkHypha.InsertIfNewKeepExistence() - h.AddOutLink(outlinkHypha) - wg.Done() - }() + outlinkHypha.AddBackLink(h) + outlinkHypha.InsertIfNewKeepExistence() + h.AddOutLink(outlinkHypha) } - wg.Wait() } else { log.Println("Error when reading text contents of ā€˜%sā€™: %s", h.Name, err.Error()) } diff --git a/templates/asset.qtpl.go b/templates/asset.qtpl.go index 1725377..c739b62 100644 --- a/templates/asset.qtpl.go +++ b/templates/asset.qtpl.go @@ -280,7 +280,7 @@ mark { background: rgba(130, 80, 30, 5); color: inherit; } } - +.backlinks { display: none; } `) //line templates/asset.qtpl:2 qw422016.N().S(` diff --git a/templates/default.css b/templates/default.css index daddf05..9984be5 100644 --- a/templates/default.css +++ b/templates/default.css @@ -255,4 +255,4 @@ mark { background: rgba(130, 80, 30, 5); color: inherit; } } - +.backlinks { display: none; }