1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-10-30 03:36:16 +00:00

Mycomarkup: Migrate to v3.5.0

Image layouts!
This commit is contained in:
Timur Ismagilov 2021-12-19 17:35:18 +03:00
parent 7d2457bd3f
commit 80d5583179
4 changed files with 32 additions and 29 deletions

View File

@ -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.

5
go.mod
View File

@ -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

10
go.sum
View File

@ -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=

View File

@ -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; }