From 787882cb80265a29dbf51317d7a17d47e0812930 Mon Sep 17 00:00:00 2001 From: Timur Ismagilov Date: Sat, 4 Jun 2022 22:55:00 +0300 Subject: [PATCH] Mycomarkup: Update to v4.3.2 All things interwiki Backlinks from img and rockets are temporarily broken until all other blocks gain support of interwiki. --- go.mod | 4 ++-- go.sum | 4 ++-- interwiki/interwiki.go | 13 +++++++------ shroom/mycomarkup_options.go | 1 + static/default.css | 2 +- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index 8d8a253..2e33a30 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/bouncepaw/mycorrhiza go 1.18 require ( - github.com/bouncepaw/mycomarkup/v4 v4.3.0 + github.com/bouncepaw/mycomarkup/v4 v4.3.2 github.com/go-ini/ini v1.63.2 github.com/gorilla/feeds v1.1.1 github.com/gorilla/mux v1.8.0 @@ -23,7 +23,7 @@ require ( // Use this trick to test local Mycomarkup changes, replace the path with yours, // but do not commit the change to the path: - replace github.com/bouncepaw/mycomarkup/v4 v4.3.0 => "/Users/bouncepaw/GolandProjects/mycomarkup" +// replace github.com/bouncepaw/mycomarkup/v4 v4.3.2 => "/Users/bouncepaw/GolandProjects/mycomarkup" // Use this utility every time Mycomarkup gets a major update: // https://github.com/marwan-at-work/mod diff --git a/go.sum b/go.sum index 9b885a0..e288643 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ github.com/andybalholm/brotli v1.0.2/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= github.com/andybalholm/brotli v1.0.3/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= -github.com/bouncepaw/mycomarkup/v4 v4.3.0 h1:Sj2spSzNbd/o5AKOi/Y/vRPpebaz5s9HOKP42UDA9Dg= -github.com/bouncepaw/mycomarkup/v4 v4.3.0/go.mod h1:y0b8U6Xfnh3KfNUpG3QuAXRJwqFPPpmS2kYvLzaf688= +github.com/bouncepaw/mycomarkup/v4 v4.3.2 h1:2t+7OACv1/ZAsd65A/thOtoJYGGa1shirZJPB4nLsrI= +github.com/bouncepaw/mycomarkup/v4 v4.3.2/go.mod h1:y0b8U6Xfnh3KfNUpG3QuAXRJwqFPPpmS2kYvLzaf688= 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.63.2 h1:kwN3umicd2HF3Tgvap4um1ZG52/WyKT9GGdPx0CJk6Y= diff --git a/interwiki/interwiki.go b/interwiki/interwiki.go index 35c73a0..7d08752 100644 --- a/interwiki/interwiki.go +++ b/interwiki/interwiki.go @@ -3,6 +3,7 @@ package interwiki import ( "encoding/json" + "github.com/bouncepaw/mycomarkup/v4/options" "github.com/bouncepaw/mycorrhiza/files" "log" "os" @@ -30,18 +31,18 @@ func Init() { log.Printf("Loaded %d interwiki entries\n", len(theMap.list)) } -func HrefLinkFormatFor(prefix string) string { +func HrefLinkFormatFor(prefix string) (string, options.InterwikiError) { if wiki, ok := theMap.byName[prefix]; ok { - return wiki.LinkHrefFormat + return wiki.LinkHrefFormat, options.Ok } - return "{NAME}" // TODO: error + return "", options.UnknownPrefix } -func ImgSrcFormatFor(prefix string) string { +func ImgSrcFormatFor(prefix string) (string, options.InterwikiError) { if wiki, ok := theMap.byName[prefix]; ok { - return wiki.ImgSrcFormat + return wiki.ImgSrcFormat, options.Ok } - return "{NAME}" // TODO: error + return "", options.UnknownPrefix } func readInterwiki() ([]Wiki, error) { diff --git a/shroom/mycomarkup_options.go b/shroom/mycomarkup_options.go index 28ad906..61a71aa 100644 --- a/shroom/mycomarkup_options.go +++ b/shroom/mycomarkup_options.go @@ -16,6 +16,7 @@ func MarkupOptions(hyphaName string) options.Options { WebSiteURL: cfg.URL, TransclusionSupported: true, RedLinksSupported: true, + InterwikiSupported: true, HyphaExists: func(hyphaName string) bool { switch hyphae.ByName(hyphaName).(type) { case *hyphae.EmptyHypha: diff --git a/static/default.css b/static/default.css index 6d1c230..518d270 100644 --- a/static/default.css +++ b/static/default.css @@ -249,7 +249,7 @@ blockquote { border-left: 2px #999 solid; } .wikilink_new:visited {color:#a55858;} .navi-title { border-bottom: #eee 1px solid; } .upload-amnt { border: #eee 1px solid; } -.prevnext { border-top: #eee 1px solid; } +.prevnext { border-top: #eee 1px solid; clear: both; } td { border: #ddd 1px solid; } .categories-card__link:hover,