mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2025-01-06 10:00:26 +00:00
Migrate to mycomarkup v0.4.0
This commit is contained in:
parent
ec1eafc0e4
commit
b95729df39
@ -2,7 +2,7 @@ WikiName = Mycorrhiza (dev)
|
||||
NaviTitleIcon = 🧑💻
|
||||
|
||||
[Hyphae]
|
||||
HomeHypha = home
|
||||
HomeHypha = mycorrhiza_wiki
|
||||
UserHypha = u
|
||||
HeaderLinksHypha = header-links
|
||||
|
||||
|
@ -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 {
|
||||
|
2
go.mod
2
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
|
||||
|
2
go.sum
2
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=
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 515634c88a51a616f486dfefc2a7b9e6ca692689
|
||||
Subproject commit 6758d40d32b1ba2c793b6d5e8279983bee9392c0
|
@ -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)
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user