{{ . }}
-- The hypha you are trying to access does not exist yet. Why not create it? -
-diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1573ad2 --- /dev/null +++ b/Makefile @@ -0,0 +1,12 @@ +run: build + ./mycorrhiza wiki + +build: + go build . + +test: + go test ./util + +help: + echo "Read the Makefile to see what it can do. It is simple." + diff --git a/cfg/config.go b/cfg/config.go index 0a40da1..ed03401 100644 --- a/cfg/config.go +++ b/cfg/config.go @@ -28,7 +28,7 @@ var ( configJsonPath string // Default values that can be overriden in config.json - Address = "127.0.0.1:80" + Address = "0.0.0.0:80" TitleEditTemplate = `Edit %s` TitleTemplate = `%s` GenericErrorMsg = `Sorry, something went wrong` diff --git a/render/render.go b/render/render.go index a70f9f8..b1a4b60 100644 --- a/render/render.go +++ b/render/render.go @@ -23,7 +23,6 @@ func HyphaEdit(h *fs.Hypha) []byte { // withMap(hyphaData). wrapInBase(map[string]string{ "Title": fmt.Sprintf(cfg.TitleEditTemplate, h.FullName), - "Header": layout("edit/header").withString(h.FullName).String(), "Sidebar": layout("edit/sidebar").withMap(hyphaData).String(), }) } @@ -37,12 +36,26 @@ func HyphaUpdateOk(h *fs.Hypha) []byte { // // Hypha404 renders 404 page for nonexistent page. func Hypha404(name, _ string) []byte { - return hyphaGeneric(name, name, "view/404") + return layout("view/404"). + withMap(map[string]string{ + "PageTitle": name, + "Tree": hyphaTree(name), + }). + wrapInBase(map[string]string{ + "Title": fmt.Sprintf(cfg.TitleTemplate, name), + }) } // HyphaPage renders hypha viewer. func HyphaPage(name, content string) []byte { - return hyphaGeneric(name, content, "view/index") + return layout("view/index"). + withMap(map[string]string{ + "Content": content, + "Tree": hyphaTree(name), + }). + wrapInBase(map[string]string{ + "Title": fmt.Sprintf(cfg.TitleTemplate, name), + }) } // hyphaGeneric is used when building renderers for all types of hypha pages @@ -62,20 +75,17 @@ func (lyt *Layout) wrapInBase(keys map[string]string) []byte { } page := map[string]string{ "Title": cfg.SiteTitle, - "Main": "", + "Content": lyt.String(), "SiteTitle": cfg.SiteTitle, } for key, val := range keys { page[key] = val } - page["Main"] = lyt.String() return layout("base").withMap(page).Bytes() } func hyphaTree(name string) string { - return layout("view/sidebar"). - withMap(map[string]string{"Tree": fs.Hs.GetTree(name, true).AsHtml()}). - String() + return fs.Hs.GetTree(name, true).AsHtml() } type Layout struct { diff --git a/wiki/config.json b/wiki/config.json index 2f2abee..5e49f42 100644 --- a/wiki/config.json +++ b/wiki/config.json @@ -1,5 +1,5 @@ { - "address": "127.0.0.1:1737", + "address": "0.0.0.0:1737", "theme": "default-light", "site-title": "🍄 MycorrhizaWiki", "title-templates": { diff --git a/wiki/main/fruit/pear/2.markdown b/wiki/main/fruit/pear/2.markdown new file mode 100644 index 0000000..30c8f65 --- /dev/null +++ b/wiki/main/fruit/pear/2.markdown @@ -0,0 +1,5 @@ +A **pear** is a sweet fruit, usually with a green skin and a lot of juice, that has a round base and is slightly pointed towards the stem. + +Source of info: [cambridge dict](https://dictionary.cambridge.org/ru/словарь/английский/pear) + +По-русски: груша \ No newline at end of file diff --git a/wiki/main/fruit/pear/meta.json b/wiki/main/fruit/pear/meta.json index 648d1be..ddb6a14 100644 --- a/wiki/main/fruit/pear/meta.json +++ b/wiki/main/fruit/pear/meta.json @@ -14,6 +14,17 @@ "binary_mime": "", "text_name": "1.markdown", "binary_name": "" + }, + "2": { + "tags": null, + "name": "Pear", + "comment": "Update :Main/Fruit/Pear", + "author": "", + "time": 1593949655, + "text_mime": "text/markdown", + "binary_mime": "", + "text_name": "2.markdown", + "binary_name": "" } } } \ No newline at end of file diff --git a/wiki/main/fungus/2.markdown b/wiki/main/fungus/2.markdown new file mode 100644 index 0000000..4233359 --- /dev/null +++ b/wiki/main/fungus/2.markdown @@ -0,0 +1,3 @@ +A **fungus** is any member of the group of eukaryotic organisms that includes microorganisms such as yeasts and molds, as well as the more familiar mushrooms. These organisms are classified as a kingdom, which is separate from the other eukaryotic life kingdoms of plants and animals. + +По-русски: грибы. diff --git a/wiki/main/fungus/meta.json b/wiki/main/fungus/meta.json index 1742e90..065253b 100644 --- a/wiki/main/fungus/meta.json +++ b/wiki/main/fungus/meta.json @@ -14,6 +14,19 @@ "binary_mime": "", "text_name": "1.markdown", "binary_name": "" + }, + "2": { + "tags": [ + "" + ], + "name": "Fungus", + "comment": "Update :Main/Fungus", + "author": "", + "time": 1593951453, + "text_mime": "text/markdown", + "binary_mime": "", + "text_name": "2.markdown", + "binary_name": "" } } } \ No newline at end of file diff --git a/wiki/main/test/1.markdown b/wiki/main/test/1.markdown new file mode 100644 index 0000000..565097b --- /dev/null +++ b/wiki/main/test/1.markdown @@ -0,0 +1 @@ +This is a testing page to test that editing works, etc diff --git a/wiki/main/test/meta.json b/wiki/main/test/meta.json new file mode 100644 index 0000000..7478662 --- /dev/null +++ b/wiki/main/test/meta.json @@ -0,0 +1,19 @@ +{ + "views": 0, + "deleted": false, + "revisions": { + "1": { + "tags": [ + "" + ], + "name": "Test", + "comment": "Update :Main/Test", + "author": "", + "time": 1593943985, + "text_mime": "text/markdown", + "binary_mime": "", + "text_name": "1.markdown", + "binary_name": "" + } + } +} \ No newline at end of file diff --git a/wiki/sys/theme/default-light/base.html/1.html b/wiki/sys/theme/default-light/base.html/1.html index 54bc2f7..07d5cbf 100644 --- a/wiki/sys/theme/default-light/base.html/1.html +++ b/wiki/sys/theme/default-light/base.html/1.html @@ -2,6 +2,7 @@
Good types are text/markdown and text/plain
Please make your comment helpful
- - -Tags are separated by commas, whitespace is ignored
- - -If this hypha has a file like that, the text above is meant to be a description of it
- - -- - Cancel -
-Saved successfully. Go back
diff --git a/wiki/sys/theme/default-light/view/404.html/1.html b/wiki/sys/theme/default-light/view/404.html/1.html index 1a16087..d8cf4a5 100644 --- a/wiki/sys/theme/default-light/view/404.html/1.html +++ b/wiki/sys/theme/default-light/view/404.html/1.html @@ -1,6 +1,18 @@ -- The hypha you are trying to access does not exist yet. Why not create it? -
-+ The hypha you are trying to access does not exist yet. Why not create it? +
+