From 80d558317950b204efa13454c1c1137d5598b0a5 Mon Sep 17 00:00:00 2001 From: Timur Ismagilov Date: Sun, 19 Dec 2021 17:35:18 +0300 Subject: [PATCH] Mycomarkup: Migrate to v3.5.0 Image layouts! --- cfg/header_links.go | 32 ++++++++++++++------------------ go.mod | 5 ++--- go.sum | 10 ++-------- static/default.css | 14 ++++++++++++++ 4 files changed, 32 insertions(+), 29 deletions(-) diff --git a/cfg/header_links.go b/cfg/header_links.go index 8322945..0645e40 100644 --- a/cfg/header_links.go +++ b/cfg/header_links.go @@ -2,8 +2,9 @@ package cfg // See https://mycorrhiza.wiki/hypha/configuration/header import ( + "github.com/bouncepaw/mycomarkup/v3" "github.com/bouncepaw/mycomarkup/v3/blocks" - "strings" + "github.com/bouncepaw/mycomarkup/v3/mycocontext" ) // HeaderLinks is a list off current header links. Feel free to iterate it directly but do not modify it by yourself. Call ParseHeaderLinks if you need to set new header links. @@ -21,24 +22,19 @@ func SetDefaultHeaderLinks() { // ParseHeaderLinks extracts all rocketlinks from the given text and saves them as header links. func ParseHeaderLinks(text string) { - HeaderLinks = []HeaderLink{} - for _, line := range strings.Split(text, "\n") { - // There is a false positive when parsing markup like that: - // - // ``` - // => this is not a link, it is part of the preformatted block - // ``` - // - // I do not really care. - if strings.HasPrefix(line, "=>") { - rl := blocks.ParseRocketLink(line, HeaderLinksHypha) - href, display := rl.Href(), rl.Display() - HeaderLinks = append(HeaderLinks, HeaderLink{ - Href: href, - Display: display, - }) + ctx, _ := mycocontext.ContextFromStringInput("", text) + // We call for side-effects + _ = mycomarkup.BlockTree(ctx, func(block blocks.Block) { + switch launchpad := block.(type) { + case blocks.LaunchPad: + for _, rocket := range launchpad.Rockets { + HeaderLinks = append(HeaderLinks, HeaderLink{ + Href: rocket.Href(), + Display: rocket.Display(), + }) + } } - } + }) } // HeaderLink represents a header link. Header links are the links shown in the top gray bar. diff --git a/go.mod b/go.mod index 6032795..dab76db 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/bouncepaw/mycorrhiza go 1.17 require ( - github.com/bouncepaw/mycomarkup/v3 v3.4.1 + github.com/bouncepaw/mycomarkup/v3 v3.5.0 github.com/go-ini/ini v1.63.2 github.com/gorilla/feeds v1.1.1 github.com/gorilla/mux v1.8.0 @@ -14,7 +14,6 @@ require ( ) require ( - github.com/chekoopa/go-localize v0.4.0 // indirect github.com/kr/pretty v0.2.1 // indirect github.com/stretchr/testify v1.7.0 // indirect golang.org/x/sys v0.0.0-20211109184856-51b60fd695b3 // indirect @@ -22,7 +21,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/v3 v3.4.1 => "/Users/bouncepaw/GolandProjects/mycomarkup" +// replace github.com/bouncepaw/mycomarkup/v3 v3.5.0 => "/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 077bb04..04e7340 100644 --- a/go.sum +++ b/go.sum @@ -1,11 +1,7 @@ -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= 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/v3 v3.4.1 h1:9rv0X/QzMM2TlVu+SNjkNQTARY1jYxhl/YZJcYrsIQo= -github.com/bouncepaw/mycomarkup/v3 v3.4.1/go.mod h1:BpiGUVsYCgRZCDxF0iIdc08LJokm/Ab36S/Hif0J6D0= -github.com/chekoopa/go-localize v0.4.0 h1:XUgliKdAE0fff2MOEfjHP/Sj1Iy6Yxn4zXOj3jXfDE8= -github.com/chekoopa/go-localize v0.4.0/go.mod h1:bMeziCOnL4H5lGOy2o0eWBRNht2x2RRNWGKZ4oDuxNU= +github.com/bouncepaw/mycomarkup/v3 v3.5.0 h1:KaVAFliD8jTXSpeVRq9VLpHBURR06EsQm9EhDX7d7fE= +github.com/bouncepaw/mycomarkup/v3 v3.5.0/go.mod h1:BpiGUVsYCgRZCDxF0iIdc08LJokm/Ab36S/Hif0J6D0= 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= @@ -53,7 +49,5 @@ golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.7 h1:VUgggvou5XRW9mHwD/yXxIYSMtY0zoKQf/v226p2nyo= -gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/static/default.css b/static/default.css index 156fffe..2e1276a 100644 --- a/static/default.css +++ b/static/default.css @@ -150,6 +150,20 @@ aside { clear: both; } .img-gallery { text-align: center; margin-top: .25rem; margin-bottom: .25rem; } .img-gallery_many-images { border-radius: .25rem; padding: .5rem; } +@media screen and (min-width: 700px) { + .img-gallery_arrangement-grid { + display: grid; + grid-template-columns: 1fr 1fr; + } + + .img-gallery_position-end { + float: right; + } + + .img-gallery_position-start { + float: left; + } +} .img-gallery img { max-width: 100%; max-height: 50vh; } figure { margin: 0; } figcaption { padding-bottom: .5rem; }