diff --git a/assets/devconfig.ini b/assets/devconfig.ini index 8321181..dba810d 100644 --- a/assets/devconfig.ini +++ b/assets/devconfig.ini @@ -2,7 +2,7 @@ WikiName = Mycorrhiza (dev) NaviTitleIcon = 🧑‍💻 [Hyphae] -HomeHypha = home +HomeHypha = mycorrhiza_wiki UserHypha = u HeaderLinksHypha = header-links diff --git a/gemini.go b/gemini.go index 91fa479..ba50649 100644 --- a/gemini.go +++ b/gemini.go @@ -21,8 +21,6 @@ import ( "github.com/bouncepaw/mycorrhiza/cfg" "github.com/bouncepaw/mycorrhiza/hyphae" "github.com/bouncepaw/mycorrhiza/util" - - "github.com/bouncepaw/mycomarkup/doc" ) func geminiHomeHypha(w *gemini.ResponseWriter, rq *gemini.Request) { @@ -46,8 +44,7 @@ func geminiHypha(w *gemini.ResponseWriter, rq *gemini.Request) { if h.Exists { fileContentsT, errT := ioutil.ReadFile(h.TextPath) if errT == nil { - md := doc.Doc(hyphaName, string(fileContentsT)) - contents = md.AsGemtext() + contents = string(fileContentsT) } } if hasAmnt { diff --git a/go.mod b/go.mod index 6ee2068..a9f0134 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.3.3 + github.com/bouncepaw/mycomarkup v0.4.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 385cb76..8076aec 100644 --- a/go.sum +++ b/go.sum @@ -5,6 +5,8 @@ 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.3.3 h1:Mw26iJsxtIgGR0yuMrgyHEj14VchetCdDvqGlj+m4OE= github.com/bouncepaw/mycomarkup v0.3.3/go.mod h1:0n6thlGGgrx2Y/2NaaUH4qHW4v1xJ+EpW7yMFUxNRIg= +github.com/bouncepaw/mycomarkup v0.4.0 h1:c61uxVTzeozIIErM7RQSdjgyMTOtEDhK/0fJp0vDygo= +github.com/bouncepaw/mycomarkup v0.4.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/metarrhiza b/metarrhiza index 515634c..6758d40 160000 --- a/metarrhiza +++ b/metarrhiza @@ -1 +1 @@ -Subproject commit 515634c88a51a616f486dfefc2a7b9e6ca692689 +Subproject commit 6758d40d32b1ba2c793b6d5e8279983bee9392c0 diff --git a/web/mutators.go b/web/mutators.go index 8c9cc05..dfda455 100644 --- a/web/mutators.go +++ b/web/mutators.go @@ -2,7 +2,8 @@ package web import ( "fmt" - "github.com/bouncepaw/mycomarkup/doc" + "github.com/bouncepaw/mycomarkup" + "github.com/bouncepaw/mycomarkup/mycocontext" "log" "net/http" @@ -188,6 +189,8 @@ func handlerUploadText(w http.ResponseWriter, rq *http.Request) { } if action == "Preview" { + ctx, _ := mycocontext.ContextFromStringInput(hyphaName, textData) + util.HTTP200Page( w, views.BaseHTML( @@ -197,7 +200,7 @@ func handlerUploadText(w http.ResponseWriter, rq *http.Request) { hyphaName, textData, "", - doc.Doc(hyphaName, textData).AsHTML()), + mycomarkup.BlocksToHTML(ctx, mycomarkup.BlockTree(ctx))), u)) } else { http.Redirect(w, rq, "/hypha/"+hyphaName, http.StatusSeeOther) diff --git a/web/readers.go b/web/readers.go index 5fb97bd..7054c9d 100644 --- a/web/readers.go +++ b/web/readers.go @@ -2,9 +2,7 @@ package web import ( "fmt" - "github.com/bouncepaw/mycomarkup" - "github.com/bouncepaw/mycomarkup/doc" - "github.com/bouncepaw/mycomarkup/parser" + "github.com/bouncepaw/mycomarkup/mycocontext" "io/ioutil" "log" "net/http" @@ -18,6 +16,8 @@ import ( "github.com/bouncepaw/mycorrhiza/user" "github.com/bouncepaw/mycorrhiza/util" "github.com/bouncepaw/mycorrhiza/views" + + "github.com/bouncepaw/mycomarkup" ) func initReaders() { @@ -75,7 +75,8 @@ func handlerRevision(w http.ResponseWriter, rq *http.Request) { u = user.FromRequest(rq) ) if err == nil { - contents = doc.Doc(hyphaName, textContents).AsHTML() + ctx, _ := mycocontext.ContextFromStringInput(hyphaName, textContents) + contents = mycomarkup.BlocksToHTML(ctx, mycomarkup.BlockTree(ctx)) } page := views.RevisionHTML( rq, @@ -124,10 +125,9 @@ func handlerHypha(w http.ResponseWriter, rq *http.Request) { fileContentsT, errT := ioutil.ReadFile(h.TextPath) _, errB := os.Stat(h.BinaryPath) if errT == nil { - ctx, _ := parser.ContextFromStringInput(hyphaName, "") // FIXME: - md := doc.Doc(hyphaName, string(fileContentsT)) - ast := md.Lex() - contents = doc.GenerateHTML(ast, 0) + ctx, _ := mycocontext.ContextFromStringInput(hyphaName, string(fileContentsT)) + ast := mycomarkup.BlockTree(ctx) + contents = mycomarkup.BlocksToHTML(ctx, ast) openGraph = mycomarkup.OpenGraphHTML(ctx, ast) } if !os.IsNotExist(errB) {