1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-12-12 13:30:26 +00:00

Implement Betula interwiki targets

Implements #198
This commit is contained in:
Timur Ismagilov 2023-08-06 02:13:34 +05:00
parent 353d462bbe
commit c2619a6b82
6 changed files with 15 additions and 7 deletions

4
go.mod
View File

@ -3,7 +3,7 @@ module github.com/bouncepaw/mycorrhiza
go 1.19 go 1.19
require ( require (
git.sr.ht/~bouncepaw/mycomarkup/v5 v5.4.0 git.sr.ht/~bouncepaw/mycomarkup/v5 v5.5.0
github.com/go-ini/ini v1.63.2 github.com/go-ini/ini v1.63.2
github.com/gorilla/feeds v1.1.1 github.com/gorilla/feeds v1.1.1
github.com/gorilla/mux v1.8.0 github.com/gorilla/mux v1.8.0
@ -23,4 +23,4 @@ require (
// Use this trick to test local Mycomarkup changes, replace the path with yours, // Use this trick to test local Mycomarkup changes, replace the path with yours,
// but do not commit the change to the path: // but do not commit the change to the path:
// replace git.sr.ht/~bouncepaw/mycomarkup/v5 v5.4.0 => "/Users/bouncepaw/src/mycomarkup" // replace git.sr.ht/~bouncepaw/mycomarkup/v5 v5.5.0 => "/Users/bouncepaw/src/mycomarkup"

4
go.sum
View File

@ -1,5 +1,5 @@
git.sr.ht/~bouncepaw/mycomarkup/v5 v5.4.0 h1:n57ze2WEmtjhlDDDPKctp40rzo8T2bGfuR9s7UAOaVg= git.sr.ht/~bouncepaw/mycomarkup/v5 v5.5.0 h1:0Ycy67Leh4E7HGw/Z2xs/VEw6BH68QIpQdpXcJooX7w=
git.sr.ht/~bouncepaw/mycomarkup/v5 v5.4.0/go.mod h1:TCzFBqW11En4EjLfcQtJu8C/Ro7FIFR8vZ+nM9f6Q28= git.sr.ht/~bouncepaw/mycomarkup/v5 v5.5.0/go.mod h1:TCzFBqW11En4EjLfcQtJu8C/Ro7FIFR8vZ+nM9f6Q28=
github.com/andybalholm/brotli v1.0.2/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= 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/andybalholm/brotli v1.0.3/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=

View File

@ -70,7 +70,8 @@
<label for="engine{{$i}}" class="required-field">{{template "engine"}}</label> <label for="engine{{$i}}" class="required-field">{{template "engine"}}</label>
<select name="engine" id="engine{{$i}}" required> <select name="engine" id="engine{{$i}}" required>
<option value="mycorrhiza" {{if eq .Engine "mycorrhiza"}}selected{{end}}>{{template "engine/mycorrhiza"}} 🍄</option> <option value="mycorrhiza" {{if eq .Engine "mycorrhiza"}}selected{{end}}>{{template "engine/mycorrhiza"}} 🍄</option>
<option value="agora" {{if eq .Engine "agora"}}selected{{end}}>Agora ἀ</option> <option value="betula" {{if eq .Engine "betula"}}selected{{end}}>{{template "engine/betula"}} 🌳</option>
<option value="agora" {{if eq .Engine "agora"}}selected{{end}}>{{template "engine/agora"}} ἀ</option>
<option value="generic" {{if eq .Engine "generic"}}selected{{end}}>{{template "engine/generic"}}</option> <option value="generic" {{if eq .Engine "generic"}}selected{{end}}>{{template "engine/generic"}}</option>
</select> </select>
</p> </p>
@ -109,7 +110,8 @@
<label for="engine" class="required-field">{{template "engine"}}</label> <label for="engine" class="required-field">{{template "engine"}}</label>
<select name="engine" id="engine" required> <select name="engine" id="engine" required>
<option value="mycorrhiza">{{template "engine/mycorrhiza"}} 🍄</option> <option value="mycorrhiza">{{template "engine/mycorrhiza"}} 🍄</option>
<option value="agora">Agora ἀ</option> <option value="betula">{{template "engine/betula"}} 🌳</option>
<option value="agora">{{template "engine/agora"}} ἀ</option>
<option value="generic">{{template "engine/generic"}}</option> <option value="generic">{{template "engine/generic"}}</option>
</select> </select>
</p> </p>

View File

@ -22,6 +22,7 @@
<label for="engine" class="required-field">Engine:</label> <label for="engine" class="required-field">Engine:</label>
<select name="engine" id="engine" required> <select name="engine" id="engine" required>
<option value="mycorrhiza" {{if eq .Engine "mycorrhiza"}}selected{{end}}>Mycorrhiza 🍄</option> <option value="mycorrhiza" {{if eq .Engine "mycorrhiza"}}selected{{end}}>Mycorrhiza 🍄</option>
<option value="betula" {{if eq .Engine "betula"}}selected{{end}}>Betula 🌳</option>
<option value="agora" {{if eq .Engine "agora"}}selected{{end}}>Agora ἀ</option> <option value="agora" {{if eq .Engine "agora"}}selected{{end}}>Agora ἀ</option>
<option value="generic" {{if eq .Engine "generic"}}selected{{end}}>Generic (any website)</option> <option value="generic" {{if eq .Engine "generic"}}selected{{end}}>Generic (any website)</option>
</select> </select>

View File

@ -18,6 +18,8 @@ var (
{{define "aliases (,)"}}Псевдонимы (разделённые запятыми):{{end}} {{define "aliases (,)"}}Псевдонимы (разделённые запятыми):{{end}}
{{define "engine"}}Движок:{{end}} {{define "engine"}}Движок:{{end}}
{{define "engine/mycorrhiza"}}Микориза{{end}} {{define "engine/mycorrhiza"}}Микориза{{end}}
{{define "engine/betula"}}Бетула{{end}}
{{define "engine/agora"}}Агора{{end}}
{{define "engine/generic"}}Любой сайт{{end}} {{define "engine/generic"}}Любой сайт{{end}}
{{define "link href format"}}Строка форматирования атрибута href ссылки:{{end}} {{define "link href format"}}Строка форматирования атрибута href ссылки:{{end}}
{{define "img src format"}}Строка форматирования атрибута src изображения:{{end}} {{define "img src format"}}Строка форматирования атрибута src изображения:{{end}}

View File

@ -11,6 +11,7 @@ type WikiEngine string
const ( const (
Mycorrhiza WikiEngine = "mycorrhiza" Mycorrhiza WikiEngine = "mycorrhiza"
Betula WikiEngine = "betula"
Agora WikiEngine = "agora" Agora WikiEngine = "agora"
// Generic is any website. // Generic is any website.
Generic WikiEngine = "generic" Generic WikiEngine = "generic"
@ -18,7 +19,7 @@ const (
func (we WikiEngine) Valid() bool { func (we WikiEngine) Valid() bool {
switch we { switch we {
case Mycorrhiza, Agora, Generic: case Mycorrhiza, Betula, Agora, Generic:
return true return true
} }
return false return false
@ -65,6 +66,8 @@ func (w *Wiki) canonize() {
switch w.Engine { switch w.Engine {
case Mycorrhiza: case Mycorrhiza:
w.LinkHrefFormat = fmt.Sprintf("%s/hypha/{NAME}", w.URL) w.LinkHrefFormat = fmt.Sprintf("%s/hypha/{NAME}", w.URL)
case Betula:
w.LinkHrefFormat = fmt.Sprintf("%s/{BETULA-NAME}", w.URL)
case Agora: case Agora:
w.LinkHrefFormat = fmt.Sprintf("%s/node/{NAME}", w.URL) w.LinkHrefFormat = fmt.Sprintf("%s/node/{NAME}", w.URL)
default: default: