{{ . }}
++ The hypha you are trying to access does not exist yet. Why not create it? +
+diff --git a/handlers.go b/handlers.go index a15a4eb..52f1510 100644 --- a/handlers.go +++ b/handlers.go @@ -42,6 +42,10 @@ func HandlerZen(w http.ResponseWriter, rq *http.Request) { func HandlerView(w http.ResponseWriter, rq *http.Request) { if rev, ok := HandlerBase(w, rq); ok { rev.ActionView(w, HyphaPage) + } else { // Hypha does not exist + log.Println("Hypha does not exist, showing 404") + w.WriteHeader(http.StatusNotFound) + w.Write([]byte(Hypha404(mux.Vars(rq)["hypha"]))) } } diff --git a/render.go b/render.go index 90bec60..c9f80b9 100644 --- a/render.go +++ b/render.go @@ -22,19 +22,29 @@ func EditHyphaPage(name, textMime, content, tags string) string { return renderBase(renderFromMap(page, "Hypha/edit/index.html"), keys) } +// Hypha404 returns 404 page for nonexistent page. +func Hypha404(name string) string { + return HyphaGeneric(name, name, "Hypha/view/404.html") +} + // HyphaPage returns HTML page of hypha viewer. func HyphaPage(rev Revision, content string) string { + return HyphaGeneric(rev.FullName, content, "Hypha/view/index.html") +} + +// HyphaGeneric is used when building renderers for all types of hypha pages +func HyphaGeneric(name string, content, templatePath string) string { sidebar := DefaultSidebar if bside := renderFromMap(map[string]string{ - "Tree": GetTree(rev.FullName, true).AsHtml(), + "Tree": GetTree(name, true).AsHtml(), }, "Hypha/view/sidebar.html"); bside != "" { sidebar = bside } keys := map[string]string{ - "Title": fmt.Sprintf(TitleTemplate, rev.FullName), + "Title": fmt.Sprintf(TitleTemplate, name), "Sidebar": sidebar, } - return renderBase(renderFromString(content, "Hypha/view/index.html"), keys) + return renderBase(renderFromString(content, templatePath), keys) } // renderBase collects and renders page from base template diff --git a/w/m/Fungus/1.markdown b/w/m/Fungus/1.markdown new file mode 100644 index 0000000..bb74c76 --- /dev/null +++ b/w/m/Fungus/1.markdown @@ -0,0 +1 @@ +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. \ No newline at end of file diff --git a/w/m/Fungus/Amanita Muscaria/1.markdown b/w/m/Fungus/Amanita Muscaria/1.markdown new file mode 100644 index 0000000..2516173 --- /dev/null +++ b/w/m/Fungus/Amanita Muscaria/1.markdown @@ -0,0 +1,3 @@ +Amanita muscaria, commonly known as the fly agaric or fly amanita, is a basidiomycete of the genus Amanita. It is also a muscimol mushroom. Native throughout the temperate and boreal regions of the Northern Hemisphere, Amanita muscaria has been unintentionally introduced to many countries in the Southern Hemisphere, generally as a symbiont with pine and birch plantations, and is now a true cosmopolitan species. It associates with various deciduous and coniferous trees. + +It is not an [](Apple)! \ No newline at end of file diff --git a/w/m/Fungus/Amanita Muscaria/2.markdown b/w/m/Fungus/Amanita Muscaria/2.markdown new file mode 100644 index 0000000..2399b27 --- /dev/null +++ b/w/m/Fungus/Amanita Muscaria/2.markdown @@ -0,0 +1,4 @@ +Amanita muscaria, commonly known as the fly agaric or fly amanita, is a basidiomycete of the genus Amanita. It is also a muscimol mushroom. Native throughout the temperate and boreal regions of the Northern Hemisphere, Amanita muscaria has been unintentionally introduced to many countries in the Southern Hemisphere, generally as a symbiont with pine and birch plantations, and is now a true cosmopolitan species. It associates with various deciduous and coniferous trees. + +It is not an [Apple](Apple)! + \ No newline at end of file diff --git a/w/m/Fungus/Amanita Muscaria/3.markdown b/w/m/Fungus/Amanita Muscaria/3.markdown new file mode 100644 index 0000000..ffeae56 --- /dev/null +++ b/w/m/Fungus/Amanita Muscaria/3.markdown @@ -0,0 +1,5 @@ +Amanita muscaria, commonly known as the fly agaric or fly amanita, is a basidiomycete of the genus Amanita. It is also a muscimol mushroom. Native throughout the temperate and boreal regions of the Northern Hemisphere, Amanita muscaria has been unintentionally introduced to many countries in the Southern Hemisphere, generally as a symbiont with pine and birch plantations, and is now a true cosmopolitan species. It associates with various deciduous and coniferous trees. + +It is not an [Apple](/Apple)! + + \ No newline at end of file diff --git a/w/m/Fungus/Amanita Muscaria/4.markdown b/w/m/Fungus/Amanita Muscaria/4.markdown new file mode 100644 index 0000000..51eeda9 --- /dev/null +++ b/w/m/Fungus/Amanita Muscaria/4.markdown @@ -0,0 +1,6 @@ +Amanita muscaria, commonly known as the fly agaric or fly amanita, is a basidiomycete of the genus Amanita. It is also a muscimol mushroom. Native throughout the temperate and boreal regions of the Northern Hemisphere, Amanita muscaria has been unintentionally introduced to many countries in the Southern Hemisphere, generally as a symbiont with pine and birch plantations, and is now a true cosmopolitan species. It associates with various deciduous and coniferous trees. + +It is not an [Apple](/Fruit/Apple)! + + + \ No newline at end of file diff --git a/w/m/Fungus/Amanita Muscaria/meta.json b/w/m/Fungus/Amanita Muscaria/meta.json new file mode 100644 index 0000000..741d52e --- /dev/null +++ b/w/m/Fungus/Amanita Muscaria/meta.json @@ -0,0 +1,58 @@ +{ + "views": 0, + "deleted": false, + "revisions": { + "1": { + "tags": [ + "" + ], + "name": "Amanita Muscaria", + "comment": "Update Fungus/Amanita Muscaria", + "author": "", + "time": 1592836062, + "text_mime": "text/markdown", + "binary_mime": "", + "text_name": "1.markdown", + "binary_name": "" + }, + "2": { + "tags": [ + "" + ], + "name": "Amanita Muscaria", + "comment": "Update Fungus/Amanita Muscaria", + "author": "", + "time": 1592836073, + "text_mime": "text/markdown", + "binary_mime": "", + "text_name": "2.markdown", + "binary_name": "" + }, + "3": { + "tags": [ + "" + ], + "name": "Amanita Muscaria", + "comment": "Update Fungus/Amanita Muscaria", + "author": "", + "time": 1592836084, + "text_mime": "text/markdown", + "binary_mime": "", + "text_name": "3.markdown", + "binary_name": "" + }, + "4": { + "tags": [ + "" + ], + "name": "Amanita Muscaria", + "comment": "Update Fungus/Amanita Muscaria", + "author": "", + "time": 1592836099, + "text_mime": "text/markdown", + "binary_mime": "", + "text_name": "4.markdown", + "binary_name": "" + } + } +} \ No newline at end of file diff --git a/w/m/Fungus/Amanita Regalis/1.bin b/w/m/Fungus/Amanita Regalis/1.bin new file mode 100644 index 0000000..2059fbd Binary files /dev/null and b/w/m/Fungus/Amanita Regalis/1.bin differ diff --git a/w/m/Fungus/Amanita Regalis/1.markdown b/w/m/Fungus/Amanita Regalis/1.markdown new file mode 100644 index 0000000..7ea6c4c --- /dev/null +++ b/w/m/Fungus/Amanita Regalis/1.markdown @@ -0,0 +1,7 @@ +Шляпка 7—16(20) см в диаметре, полушаровидная, раскрывающаяся до выпуклой и почти плоской со слабо вдавленным центром, с радиально разлинованным краем. Окраска тёмно-умброво-коричневая, оливково-охристая, охристо-коричневая, иногда серо-жёлтая, в центре более интенсивная. Общее покрывало на молодых грибах опушённое, ярко-жёлтое, затем остаётся в виде легко смываемых обрывков, на солнце белеющих, а к старости иногда становящихся серо-жёлтыми. + + +Пластинки частые, сначала узко-приросшие к ножке, затем свободные от неё, кремовые, с многочисленными пластиночками разной длины. + + +Ножка достигает 9—20 см в высоту и 1—2,5 см в поперечнике, утончающаяся кверху, в основании с яйцевидным или шаровидным утолщением. Поверхность ножки волокнисто-бархатистая, белая или беловатая, при прикосновении иногда слабо буреющая. Кольцо в верхней части ножки, беловатое, перепончатое, не разлинованное. Остатки общего покрывала в виде нескольких поясков желтоватых бородавчатых хлопьев на утолщении ножки. \ No newline at end of file diff --git a/w/m/Fungus/Amanita Regalis/meta.json b/w/m/Fungus/Amanita Regalis/meta.json new file mode 100644 index 0000000..1f06a09 --- /dev/null +++ b/w/m/Fungus/Amanita Regalis/meta.json @@ -0,0 +1,19 @@ +{ + "views": 0, + "deleted": false, + "revisions": { + "1": { + "tags": [ + "" + ], + "name": "Amanita Regalis", + "comment": "Update Fungus/Amanita Regalis", + "author": "", + "time": 1592838045, + "text_mime": "text/markdown", + "binary_mime": "image/jpeg", + "text_name": "1.markdown", + "binary_name": "1.jpeg" + } + } +} \ No newline at end of file diff --git a/w/m/Fungus/meta.json b/w/m/Fungus/meta.json new file mode 100644 index 0000000..1742e90 --- /dev/null +++ b/w/m/Fungus/meta.json @@ -0,0 +1,19 @@ +{ + "views": 0, + "deleted": false, + "revisions": { + "1": { + "tags": [ + "" + ], + "name": "Fungus", + "comment": "Update Fungus", + "author": "", + "time": 1592835944, + "text_mime": "text/markdown", + "binary_mime": "", + "text_name": "1.markdown", + "binary_name": "" + } + } +} \ No newline at end of file diff --git a/w/m/sys/main.css/9.css b/w/m/sys/main.css/9.css index e24c004..618b4f3 100644 --- a/w/m/sys/main.css/9.css +++ b/w/m/sys/main.css/9.css @@ -14,12 +14,20 @@ body { padding: 12px 24px; } +.msg { + background-color: #f4f4f4; + padding: 1rem; +} +.msg_hypha-does-not-exist { + border-radius: 1rem; +} + .shroom { margin: 0; } .shroom__button { - border-radius: 8px; + border-radius: 1rem; padding: 8px 16px 8px 0; border: none; background: #f0f2f4; @@ -65,7 +73,7 @@ a:visited { } h1, h2, h3, h4, h5, h6 { - margin: 1em 0 0.25em; + margin: 0.5em 0 0.25em; } .page { @@ -178,7 +186,7 @@ footer a, footer a:visited { .sidebar { padding: 16px 0; - border-radius: 8px; + border-radius: 1rem; background: #f4f4f4; } diff --git a/w/templates/Hypha/view/404.html b/w/templates/Hypha/view/404.html new file mode 100644 index 0000000..3ff59e4 --- /dev/null +++ b/w/templates/Hypha/view/404.html @@ -0,0 +1,8 @@ +