diff --git a/help/en/interwiki.myco b/help/en/interwiki.myco index 466b654..af0bb93 100644 --- a/help/en/interwiki.myco +++ b/help/en/interwiki.myco @@ -9,14 +9,14 @@ In Mycomarkup, you can address a different wiki by prefixing the link target wit The interwiki prefixes obey the same naming rules as hyphae. In particular, they are case-insensitive, among other things. Every interwiki entry has one main name and it might have any number of aliases, which can be used interchangeably. -See [[/interwiki]] for the list of configured interwiki entries. Unlike the WWW, there is no distributed list of wikis, so each wiki administrator has to maintain their own list. +See [[/interwiki]] for the list of configured interwiki entries. Unlike the WWW, there is no distributed list of wikis similar to DNS, so each wiki administrator has to maintain their own list. == Mycorrhiza interwiki -Intermycorrhizal interwiki works the best, due to the nature of hyphae. Unlike with other systems, you can address images from the other wikis reliably. +Intermycorrhizal interwiki works the best, due to the nature of hyphae. Unlike with some other systems, you can address images from the other wikis reliably. ```myco img { - melanocarpa + melanocarpa>quadrat 12 } ``` @@ -24,9 +24,43 @@ img { //This section is meant for wiki administrators.// **Intermap**, or interwiki map, is the collection of all configured interwiki entries. To configure it, an administrator has to visit [[/interwiki]] and change the existing entries or add a new one. -You can also change `interwiki.json` directly. +Entries have the following fields: +*. { + **Name.** This is the canonical name of the wiki and one of the prefixes you can use for interlinks. +} +*. { + **Aliases.** They are separated with commas. You don't have to set them up. -There are three supported engine types: -* `mycorrhiza` is used for Mycorrhiza wikis. -* `agora` is used for intances of Agora, such as [[https://anagora.org]]. -* `generic` is used for everything else. + A good idea is to have the full name in the //name// field (such as `wikipedia`), and shorter names in //aliases// (such as `pedia` and `wp`). +} +*. { + **URL.** The URL of the index/home/main page of the wiki. It should not end on trailing slash. +} +*. { + **Engine.** This is the software the target wiki runs. + + There are two engines supported explicitly: + * Mycorrhiza + * [[https://anagora.org | Agora]] + + Choose the //Generic// option for sites running different software. +} +*. { + **Formats.** Because interlinks are supported for two cases (hyperlinks and images), there has to be a way to convert a resource name to an URL of the resource. Format strings are a way to do that. + + There are two format strings: one for hyperlinks, one for images. They directly correspond to HTML's `href` and `src` attributes of the `a` and `img` tags. + + For Mycorrhiza wikis, you don't have to set them, they are set automatically to the following values (replace `https\:/\/example.org` with the URL of the target wiki): + * Link: `https\:/\/example.org/hypha/{NAME}` + * Image: `https\:/\/example.org/binary/{NAME}` + + For Agora, they are set to: + * Link: `https\:/\/example.org/node/{NAME}` + * Image: `https\:/\/example.org/{NAME}`, which doesn't make a lot of sense + + For generic sites, you will have to think of something by yourself. If you do not set it, it will default to `https\:/\/example.org/{NAME}`. + + `{NAME}` is substituted. For example, from link `[[Melanocarpa>uxn]]`, `{NAME}` is replaced with `uxn`. +} + +You can also change `interwiki.json` directly. Reload the wiki after editing it. \ No newline at end of file diff --git a/interwiki/view_interwiki.html b/interwiki/view_interwiki.html index ba569c2..12d8159 100644 --- a/interwiki/view_interwiki.html +++ b/interwiki/view_interwiki.html @@ -1,5 +1,16 @@ -{{define "interwiki map"}}Interwiki map{{end}} +{{define "interwiki map"}}Intermap{{end}} {{define "title"}}{{template "interwiki map"}}{{end}} +{{define "name"}}Name:{{end}} +{{define "aliases"}}Aliases:{{end}} +{{define "aliases (,)"}}Aliases (separated by commas):{{end}} +{{define "engine"}}Engine:{{end}} + {{define "engine/mycorrhiza"}}Mycorrhiza{{end}} + {{define "engine/generic"}}Generic (any website){{end}} +{{define "url"}}URL{{end}} +{{define "link href format"}}Link href attribute format string:{{end}} +{{define "img src format"}}Image src attribute format string:{{end}} +{{define "unset map"}}No interwiki map set.{{end}} +{{define "add interwiki entry"}}Add interwiki entry{{end}} {{define "static map"}} {{if len .Entries}} @@ -7,29 +18,29 @@ {{range $i, $wiki := .Entries}}
  • -
    Name
    +
    {{template "name"}}
    {{.Name}}
    -
    Aliases
    +
    {{template "aliases"}}
    {{range .Aliases}}
    {{.}}
    {{end}} -
    Engine
    +
    {{template "engine"}}
    {{.Engine}}
    -
    URL
    +
    {{template "url"}}
    {{.URL}}
    -
    Link href format
    +
    {{template "link href format"}}
    {{.LinkHrefFormat}}
    -
    Img src format
    +
    {{template "img src format"}}
    {{.ImgSrcFormat}}
  • {{end}} {{else}} -

    No interwiki map set.

    +

    {{template "unset map"}}

    {{end}} {{end}} @@ -41,74 +52,74 @@ {{range $i, $wiki := .Entries}}

    - +

    - +

    - +

    - +

    - +

    - +

    - +
    {{end}} {{end}}
    -

    Add interwiki entry

    +

    {{template "add interwiki entry"}}

    - +

    - +

    - +

    - +

    - +

    - +

    @@ -116,14 +127,16 @@
    {{end}} +{{define "documentation."}}Documentation.{{end}} +{{define "edit separately."}}Edit and save every the entry separately.{{end}} {{define "body"}}

    {{template "interwiki map"}}

    {{if .CanEdit}} -

    Documentation. Edit and save every entry separately.

    +

    {{template "documentation."}} {{template "edit separately."}}

    {{template "authorized map" .}} {{else}} -

    Documentation.

    +

    {{template "documentation."}}

    {{template "static map" .}} {{end}}
    diff --git a/interwiki/web.go b/interwiki/web.go index 63d9843..c69dae8 100644 --- a/interwiki/web.go +++ b/interwiki/web.go @@ -10,8 +10,22 @@ import ( var ( //go:embed *html - fs embed.FS - ruTranslation = `` + fs embed.FS + ruTranslation = ` +{{define "interwiki map"}}Π˜Π½Ρ‚Π΅Ρ€ΠΊΠ°Ρ€Ρ‚Π°{{end}} +{{define "name"}}НазваниС:{{end}} +{{define "aliases"}}ΠŸΡΠ΅Π²Π΄ΠΎΠ½ΠΈΠΌΡ‹:{{end}} +{{define "aliases (,)"}}ΠŸΡΠ΅Π²Π΄ΠΎΠ½ΠΈΠΌΡ‹ (Ρ€Π°Π·Π΄Π΅Π»Ρ‘Π½Π½Ρ‹Π΅ запятыми):{{end}} +{{define "engine"}}Π”Π²ΠΈΠΆΠΎΠΊ:{{end}} + {{define "engine/mycorrhiza"}}ΠœΠΈΠΊΠΎΡ€ΠΈΠ·Π°{{end}} + {{define "engine/generic"}}Π›ΡŽΠ±ΠΎΠΉ сайт{{end}} +{{define "link href format"}}Π‘Ρ‚Ρ€ΠΎΠΊΠ° форматирования Π°Ρ‚Ρ€ΠΈΠ±ΡƒΡ‚Π° href ссылки:{{end}} +{{define "img src format"}}Π‘Ρ‚Ρ€ΠΎΠΊΠ° форматирования Π°Ρ‚Ρ€ΠΈΠ±ΡƒΡ‚Π° src изобраТСния:{{end}} +{{define "unset map"}}Π˜Π½Ρ‚Π΅Ρ€ΠΊΠ°Ρ€Ρ‚Π° Π½Π΅ Π·Π°Π΄Π°Π½Π°.{{end}} +{{define "documentation."}}ДокумСнтация.{{end}} +{{define "edit separately."}}Π˜Π·ΠΌΠ΅Π½ΡΠΉΡ‚Π΅ записи ΠΏΠΎ ΠΎΡ‚Π΄Π΅Π»ΡŒΠ½ΠΎΡΡ‚ΠΈ.{{end}} +{{define "add interwiki entry"}}Π”ΠΎΠ±Π°Π²ΠΈΡ‚ΡŒ запись Π² ΠΈΠ½Ρ‚Π΅Ρ€ΠΊΠ°Ρ€Ρ‚Ρƒ{{end}} +` chainInterwiki viewutil.Chain chainNameTaken viewutil.Chain ) diff --git a/viewutil/base.html b/viewutil/base.html index 9b69e64..d24a537 100644 --- a/viewutil/base.html +++ b/viewutil/base.html @@ -1,5 +1,6 @@ {{define "confirm"}}Confirm{{end}} {{define "cancel"}}Cancel{{end}} +{{define "save"}}Save{{end}} {{define "page"}} diff --git a/viewutil/viewutil.go b/viewutil/viewutil.go index 4a3680a..133a51a 100644 --- a/viewutil/viewutil.go +++ b/viewutil/viewutil.go @@ -27,6 +27,7 @@ const ruText = ` {{define "register"}}РСгистрация{{end}} {{define "confirm"}}ΠŸΠΎΠ΄Ρ‚Π²Π΅Ρ€Π΄ΠΈΡ‚ΡŒ{{end}} {{define "cancel"}}ΠžΡ‚ΠΌΠ΅Π½Π°{{end}} +{{define "save"}}Π‘ΠΎΡ…Ρ€Π°Π½ΠΈΡ‚ΡŒ{{end}} ` func Init() {