From dbae2b35476b7c8d6abdcdc4897da46eee7245ee Mon Sep 17 00:00:00 2001 From: Timur Ismagilov Date: Thu, 13 May 2021 23:13:11 +0500 Subject: [PATCH] Update mycomarkup to v0.1.0 --- gemini.go | 4 ++-- go.mod | 2 +- go.sum | 29 ++--------------------------- shroom/init.go | 8 ++++---- web/mutators.go | 5 ++--- web/readers.go | 7 +++---- 6 files changed, 14 insertions(+), 41 deletions(-) diff --git a/gemini.go b/gemini.go index 858f91a..91fa479 100644 --- a/gemini.go +++ b/gemini.go @@ -22,7 +22,7 @@ import ( "github.com/bouncepaw/mycorrhiza/hyphae" "github.com/bouncepaw/mycorrhiza/util" - "github.com/bouncepaw/mycomarkup/legacy" + "github.com/bouncepaw/mycomarkup/doc" ) func geminiHomeHypha(w *gemini.ResponseWriter, rq *gemini.Request) { @@ -46,7 +46,7 @@ func geminiHypha(w *gemini.ResponseWriter, rq *gemini.Request) { if h.Exists { fileContentsT, errT := ioutil.ReadFile(h.TextPath) if errT == nil { - md := markup.Doc(hyphaName, string(fileContentsT)) + md := doc.Doc(hyphaName, string(fileContentsT)) contents = md.AsGemtext() } } diff --git a/go.mod b/go.mod index 188e0b5..778bbb1 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.0.0-20210512135928-b81258c9a977 + github.com/bouncepaw/mycomarkup v0.1.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 9c070a0..37c9e73 100644 --- a/go.sum +++ b/go.sum @@ -3,14 +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.0.0-20210502065108-4ddae294864d h1:H20wX93QMeQhQbXYdhofRrsFwn8jJ41zmJk5jr/1VOA= -github.com/bouncepaw/mycomarkup v0.0.0-20210502065108-4ddae294864d/go.mod h1:fx0FBKaCaV1fofgCQOu2lNIVB/5EoDg/83i8BgBdgpc= -github.com/bouncepaw/mycomarkup v0.0.0-20210511092446-956f169b1499 h1:RLKVj992QuayqjpIJ7M2csRjfhAnu9EO2r1Bm4D/WlU= -github.com/bouncepaw/mycomarkup v0.0.0-20210511092446-956f169b1499/go.mod h1:fx0FBKaCaV1fofgCQOu2lNIVB/5EoDg/83i8BgBdgpc= -github.com/bouncepaw/mycomarkup v0.0.0-20210512131946-becfae76473f h1:PgXG/AqO96jahMGQA81CWclIg90gsGt5kK4o7y0eZy8= -github.com/bouncepaw/mycomarkup v0.0.0-20210512131946-becfae76473f/go.mod h1:4Fz80hsrXi3lRVZuVfIk5+2xocp50CFAbJfGeJWb5aM= -github.com/bouncepaw/mycomarkup v0.0.0-20210512135928-b81258c9a977 h1:xLVu4JAcNhaLRaVVn7VL/l0/ZgESwuqQ2GWErrP7H8k= -github.com/bouncepaw/mycomarkup v0.0.0-20210512135928-b81258c9a977/go.mod h1:4Fz80hsrXi3lRVZuVfIk5+2xocp50CFAbJfGeJWb5aM= +github.com/bouncepaw/mycomarkup v0.1.0 h1:WsvWe1+ygGXexjjLo1Gq7Qxh7INkLZ9YCjj4SjZOUk4= +github.com/bouncepaw/mycomarkup v0.1.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= @@ -45,37 +39,18 @@ github.com/valyala/fasthttp v1.16.0/go.mod h1:YOKImeEosDdBPnxc0gy7INqi3m1zK6A+xl github.com/valyala/quicktemplate v1.6.3 h1:O7EuMwuH7Q94U2CXD6sOX8AYHqQqWtmIk690IhmpkKA= github.com/valyala/quicktemplate v1.6.3/go.mod h1:fwPzK2fHuYEODzJ9pkw0ipCPNHZ2tD5KW4lOuSdPKzY= github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200602114024-627f9648deb9/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210511113859-b0526f3d8744/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.1-0.20210319172145-bda8f5cee399/go.mod h1:9bzcO0MWcOuT0tm1iBGzDVPshzfwoVvREIui8C+MHqU= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/ini.v1 v1.62.0 h1:duBzk771uxoUuOlyRLkHsygud9+5lrlGjdFBb4mSKDU= diff --git a/shroom/init.go b/shroom/init.go index dfcad5a..003f8f5 100644 --- a/shroom/init.go +++ b/shroom/init.go @@ -6,14 +6,14 @@ import ( "github.com/bouncepaw/mycorrhiza/hyphae" "github.com/bouncepaw/mycorrhiza/views" - "github.com/bouncepaw/mycomarkup/legacy" + "github.com/bouncepaw/mycomarkup/globals" ) func init() { - markup.HyphaExists = func(hyphaName string) bool { + globals.HyphaExists = func(hyphaName string) bool { return hyphae.ByName(hyphaName).Exists } - markup.HyphaAccess = func(hyphaName string) (rawText, binaryBlock string, err error) { + globals.HyphaAccess = func(hyphaName string) (rawText, binaryBlock string, err error) { if h := hyphae.ByName(hyphaName); h.Exists { rawText, err = FetchTextPart(h) if h.BinaryPath != "" { @@ -24,7 +24,7 @@ func init() { } return } - markup.HyphaIterate = func(λ func(string)) { + globals.HyphaIterate = func(λ func(string)) { for h := range hyphae.YieldExistingHyphae() { λ(h.Name) } diff --git a/web/mutators.go b/web/mutators.go index 675d5b7..8c9cc05 100644 --- a/web/mutators.go +++ b/web/mutators.go @@ -2,6 +2,7 @@ package web import ( "fmt" + "github.com/bouncepaw/mycomarkup/doc" "log" "net/http" @@ -11,8 +12,6 @@ import ( "github.com/bouncepaw/mycorrhiza/user" "github.com/bouncepaw/mycorrhiza/util" "github.com/bouncepaw/mycorrhiza/views" - - "github.com/bouncepaw/mycomarkup/legacy" ) func initMutators() { @@ -198,7 +197,7 @@ func handlerUploadText(w http.ResponseWriter, rq *http.Request) { hyphaName, textData, "", - markup.Doc(hyphaName, textData).AsHTML()), + doc.Doc(hyphaName, textData).AsHTML()), u)) } else { http.Redirect(w, rq, "/hypha/"+hyphaName, http.StatusSeeOther) diff --git a/web/readers.go b/web/readers.go index fbafcaa..ecc2e5d 100644 --- a/web/readers.go +++ b/web/readers.go @@ -2,6 +2,7 @@ package web import ( "fmt" + "github.com/bouncepaw/mycomarkup/doc" "io/ioutil" "log" "net/http" @@ -15,8 +16,6 @@ import ( "github.com/bouncepaw/mycorrhiza/user" "github.com/bouncepaw/mycorrhiza/util" "github.com/bouncepaw/mycorrhiza/views" - - "github.com/bouncepaw/mycomarkup/legacy" ) func initReaders() { @@ -74,7 +73,7 @@ func handlerRevision(w http.ResponseWriter, rq *http.Request) { u = user.FromRequest(rq) ) if err == nil { - contents = markup.Doc(hyphaName, textContents).AsHTML() + contents = doc.Doc(hyphaName, textContents).AsHTML() } page := views.RevisionHTML( rq, @@ -123,7 +122,7 @@ func handlerHypha(w http.ResponseWriter, rq *http.Request) { fileContentsT, errT := ioutil.ReadFile(h.TextPath) _, errB := os.Stat(h.BinaryPath) if errT == nil { - md := markup.Doc(hyphaName, string(fileContentsT)) + md := doc.Doc(hyphaName, string(fileContentsT)) contents = md.AsHTML() openGraph = md.OpenGraphHTML() }