mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2025-01-08 19:00:25 +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 = 🧑💻
|
NaviTitleIcon = 🧑💻
|
||||||
|
|
||||||
[Hyphae]
|
[Hyphae]
|
||||||
HomeHypha = home
|
HomeHypha = mycorrhiza_wiki
|
||||||
UserHypha = u
|
UserHypha = u
|
||||||
HeaderLinksHypha = header-links
|
HeaderLinksHypha = header-links
|
||||||
|
|
||||||
|
@ -21,8 +21,6 @@ import (
|
|||||||
"github.com/bouncepaw/mycorrhiza/cfg"
|
"github.com/bouncepaw/mycorrhiza/cfg"
|
||||||
"github.com/bouncepaw/mycorrhiza/hyphae"
|
"github.com/bouncepaw/mycorrhiza/hyphae"
|
||||||
"github.com/bouncepaw/mycorrhiza/util"
|
"github.com/bouncepaw/mycorrhiza/util"
|
||||||
|
|
||||||
"github.com/bouncepaw/mycomarkup/doc"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func geminiHomeHypha(w *gemini.ResponseWriter, rq *gemini.Request) {
|
func geminiHomeHypha(w *gemini.ResponseWriter, rq *gemini.Request) {
|
||||||
@ -46,8 +44,7 @@ func geminiHypha(w *gemini.ResponseWriter, rq *gemini.Request) {
|
|||||||
if h.Exists {
|
if h.Exists {
|
||||||
fileContentsT, errT := ioutil.ReadFile(h.TextPath)
|
fileContentsT, errT := ioutil.ReadFile(h.TextPath)
|
||||||
if errT == nil {
|
if errT == nil {
|
||||||
md := doc.Doc(hyphaName, string(fileContentsT))
|
contents = string(fileContentsT)
|
||||||
contents = md.AsGemtext()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if hasAmnt {
|
if hasAmnt {
|
||||||
|
2
go.mod
2
go.mod
@ -5,7 +5,7 @@ go 1.14
|
|||||||
require (
|
require (
|
||||||
git.sr.ht/~adnano/go-gemini v0.1.13
|
git.sr.ht/~adnano/go-gemini v0.1.13
|
||||||
github.com/adrg/xdg v0.2.2
|
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/go-ini/ini v1.62.0
|
||||||
github.com/gorilla/feeds v1.1.1
|
github.com/gorilla/feeds v1.1.1
|
||||||
github.com/kr/pretty v0.2.1 // indirect
|
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/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 h1:Mw26iJsxtIgGR0yuMrgyHEj14VchetCdDvqGlj+m4OE=
|
||||||
github.com/bouncepaw/mycomarkup v0.3.3/go.mod h1:0n6thlGGgrx2Y/2NaaUH4qHW4v1xJ+EpW7yMFUxNRIg=
|
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 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
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=
|
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 (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/bouncepaw/mycomarkup/doc"
|
"github.com/bouncepaw/mycomarkup"
|
||||||
|
"github.com/bouncepaw/mycomarkup/mycocontext"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
@ -188,6 +189,8 @@ func handlerUploadText(w http.ResponseWriter, rq *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if action == "Preview" {
|
if action == "Preview" {
|
||||||
|
ctx, _ := mycocontext.ContextFromStringInput(hyphaName, textData)
|
||||||
|
|
||||||
util.HTTP200Page(
|
util.HTTP200Page(
|
||||||
w,
|
w,
|
||||||
views.BaseHTML(
|
views.BaseHTML(
|
||||||
@ -197,7 +200,7 @@ func handlerUploadText(w http.ResponseWriter, rq *http.Request) {
|
|||||||
hyphaName,
|
hyphaName,
|
||||||
textData,
|
textData,
|
||||||
"",
|
"",
|
||||||
doc.Doc(hyphaName, textData).AsHTML()),
|
mycomarkup.BlocksToHTML(ctx, mycomarkup.BlockTree(ctx))),
|
||||||
u))
|
u))
|
||||||
} else {
|
} else {
|
||||||
http.Redirect(w, rq, "/hypha/"+hyphaName, http.StatusSeeOther)
|
http.Redirect(w, rq, "/hypha/"+hyphaName, http.StatusSeeOther)
|
||||||
|
@ -2,9 +2,7 @@ package web
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/bouncepaw/mycomarkup"
|
"github.com/bouncepaw/mycomarkup/mycocontext"
|
||||||
"github.com/bouncepaw/mycomarkup/doc"
|
|
||||||
"github.com/bouncepaw/mycomarkup/parser"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
@ -18,6 +16,8 @@ import (
|
|||||||
"github.com/bouncepaw/mycorrhiza/user"
|
"github.com/bouncepaw/mycorrhiza/user"
|
||||||
"github.com/bouncepaw/mycorrhiza/util"
|
"github.com/bouncepaw/mycorrhiza/util"
|
||||||
"github.com/bouncepaw/mycorrhiza/views"
|
"github.com/bouncepaw/mycorrhiza/views"
|
||||||
|
|
||||||
|
"github.com/bouncepaw/mycomarkup"
|
||||||
)
|
)
|
||||||
|
|
||||||
func initReaders() {
|
func initReaders() {
|
||||||
@ -75,7 +75,8 @@ func handlerRevision(w http.ResponseWriter, rq *http.Request) {
|
|||||||
u = user.FromRequest(rq)
|
u = user.FromRequest(rq)
|
||||||
)
|
)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
contents = doc.Doc(hyphaName, textContents).AsHTML()
|
ctx, _ := mycocontext.ContextFromStringInput(hyphaName, textContents)
|
||||||
|
contents = mycomarkup.BlocksToHTML(ctx, mycomarkup.BlockTree(ctx))
|
||||||
}
|
}
|
||||||
page := views.RevisionHTML(
|
page := views.RevisionHTML(
|
||||||
rq,
|
rq,
|
||||||
@ -124,10 +125,9 @@ func handlerHypha(w http.ResponseWriter, rq *http.Request) {
|
|||||||
fileContentsT, errT := ioutil.ReadFile(h.TextPath)
|
fileContentsT, errT := ioutil.ReadFile(h.TextPath)
|
||||||
_, errB := os.Stat(h.BinaryPath)
|
_, errB := os.Stat(h.BinaryPath)
|
||||||
if errT == nil {
|
if errT == nil {
|
||||||
ctx, _ := parser.ContextFromStringInput(hyphaName, "") // FIXME:
|
ctx, _ := mycocontext.ContextFromStringInput(hyphaName, string(fileContentsT))
|
||||||
md := doc.Doc(hyphaName, string(fileContentsT))
|
ast := mycomarkup.BlockTree(ctx)
|
||||||
ast := md.Lex()
|
contents = mycomarkup.BlocksToHTML(ctx, ast)
|
||||||
contents = doc.GenerateHTML(ast, 0)
|
|
||||||
openGraph = mycomarkup.OpenGraphHTML(ctx, ast)
|
openGraph = mycomarkup.OpenGraphHTML(ctx, ast)
|
||||||
}
|
}
|
||||||
if !os.IsNotExist(errB) {
|
if !os.IsNotExist(errB) {
|
||||||
|
Loading…
Reference in New Issue
Block a user