From e1f6a64acea3e41440175cdcaa2b46a83fd44b3c Mon Sep 17 00:00:00 2001 From: Timur Ismagilov Date: Sat, 12 Jun 2021 14:42:00 +0500 Subject: [PATCH] Migrate to Mycomarkup v0.5.0 Found out that the system that generates OpenGraph does not take binary hyphae's image attachments into account. Gotta fix that, perhaps. Also red links are still not fixed. Also, nested links do not work as intended in some cases. What exactly did v0.5.0 improve? --- go.mod | 2 +- go.sum | 4 ++-- web/readers.go | 7 +++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 851ec09..e9297ed 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.14 require ( git.sr.ht/~adnano/go-gemini v0.1.13 github.com/adrg/xdg v0.2.2 - github.com/bouncepaw/mycomarkup v0.4.6 + github.com/bouncepaw/mycomarkup v0.5.0 github.com/go-ini/ini v1.62.0 github.com/gorilla/feeds v1.1.1 github.com/kr/pretty v0.2.1 // indirect diff --git a/go.sum b/go.sum index 49adf7a..48269c7 100644 --- a/go.sum +++ b/go.sum @@ -3,8 +3,8 @@ git.sr.ht/~adnano/go-gemini v0.1.13/go.mod h1:If1VxEWcZDrRt5FeAFnGTcM2Ud1E3BXs3V github.com/adrg/xdg v0.2.2 h1:A7ZHKRz5KGOLJX/bg7IPzStryhvCzAE1wX+KWawPiAo= github.com/adrg/xdg v0.2.2/go.mod h1:7I2hH/IT30IsupOpKZ5ue7/qNi3CoKzD6tL3HwpaRMQ= github.com/andybalholm/brotli v1.0.0/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= -github.com/bouncepaw/mycomarkup v0.4.6 h1:XxTD+ryAUSGTsd3Zr8Jn7HFy94Tpv+bEuKLnrjdb9QY= -github.com/bouncepaw/mycomarkup v0.4.6/go.mod h1:0n6thlGGgrx2Y/2NaaUH4qHW4v1xJ+EpW7yMFUxNRIg= +github.com/bouncepaw/mycomarkup v0.5.0 h1:hquQS1Du9LTBRRmHwsQ74Gxktu4Tn6Sz8uP4e6LVfFI= +github.com/bouncepaw/mycomarkup v0.5.0/go.mod h1:0n6thlGGgrx2Y/2NaaUH4qHW4v1xJ+EpW7yMFUxNRIg= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-ini/ini v1.62.0 h1:7VJT/ZXjzqSrvtraFp4ONq80hTcRQth1c9ZnQ3uNQvU= diff --git a/web/readers.go b/web/readers.go index 7054c9d..a800adf 100644 --- a/web/readers.go +++ b/web/readers.go @@ -3,6 +3,7 @@ package web import ( "fmt" "github.com/bouncepaw/mycomarkup/mycocontext" + "github.com/bouncepaw/mycorrhiza/cfg" "io/ioutil" "log" "net/http" @@ -126,9 +127,11 @@ func handlerHypha(w http.ResponseWriter, rq *http.Request) { _, errB := os.Stat(h.BinaryPath) if errT == nil { ctx, _ := mycocontext.ContextFromStringInput(hyphaName, string(fileContentsT)) - ast := mycomarkup.BlockTree(ctx) + ctx = mycocontext.WithWebSiteURL(ctx, cfg.URL) + getOpenGraph, descVisitor, imgVisitor := mycomarkup.OpenGraphVisitors(ctx) + ast := mycomarkup.BlockTree(ctx, descVisitor, imgVisitor) contents = mycomarkup.BlocksToHTML(ctx, ast) - openGraph = mycomarkup.OpenGraphHTML(ctx, ast) + openGraph = getOpenGraph() } if !os.IsNotExist(errB) { contents = views.AttachmentHTML(h) + contents