From 2d9e3b4a54e10728e938120725470c52c1fb62c8 Mon Sep 17 00:00:00 2001 From: bouncepaw Date: Fri, 19 Feb 2021 23:12:36 +0500 Subject: [PATCH] Move subhyphae to the bottom --- http_readers.go | 6 +- templates/asset.qtpl.go | 15 ++- templates/common.qtpl | 14 ++ templates/common.qtpl.go | 271 +++++++++++++++++++++++--------------- templates/default.css | 15 ++- templates/readers.qtpl | 6 +- templates/readers.qtpl.go | 182 +++++++++++++------------ tree/tree.go | 29 ++-- 8 files changed, 320 insertions(+), 218 deletions(-) diff --git a/http_readers.go b/http_readers.go index 3153f4d..c33025c 100644 --- a/http_readers.go +++ b/http_readers.go @@ -43,13 +43,14 @@ func handlerRevision(w http.ResponseWriter, rq *http.Request) { if err == nil { contents = markup.Doc(hyphaName, textContents).AsHTML() } - treeHTML, _, _ := tree.Tree(hyphaName) + treeHTML, subhyphae, _, _ := tree.Tree(hyphaName) page := templates.RevisionHTML( rq, hyphaName, naviTitle(hyphaName), contents, treeHTML, + subhyphae, revHash, ) w.Header().Set("Content-Type", "text/html;charset=utf-8") @@ -102,7 +103,7 @@ func handlerHypha(w http.ResponseWriter, rq *http.Request) { contents = h.BinaryHtmlBlock() + contents } } - treeHTML, prevHypha, nextHypha := tree.Tree(hyphaName) + treeHTML, subhyphaeHTML, prevHypha, nextHypha := tree.Tree(hyphaName) util.HTTP200Page(w, templates.BaseHTML( util.BeautifulName(hyphaName), @@ -110,6 +111,7 @@ func handlerHypha(w http.ResponseWriter, rq *http.Request) { naviTitle(hyphaName), contents, treeHTML, + subhyphaeHTML, h.BackLinkEntriesHTML(), prevHypha, nextHypha, hasAmnt), diff --git a/templates/asset.qtpl.go b/templates/asset.qtpl.go index bab8eb6..1725377 100644 --- a/templates/asset.qtpl.go +++ b/templates/asset.qtpl.go @@ -115,7 +115,7 @@ blockquote { margin-left: 0; padding-left: 1rem; } .wikilink_mailto::before { content: url("/static/icon/mailto"); } article { overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; line-height: 150%; } -article h1, article h2, article h3, article h4, article h5, article h6 { margin: 1.5rem 0 0 0; } +main h1, main h2, main h3, main h4, main h5, main h6 { margin: 1.5rem 0 0 0; } article p { margin: .5rem 0; } article ul, ol { padding-left: 1.5rem; margin: .5rem 0; } article code { padding: .1rem .3rem; border-radius: .25rem; font-size: 90%; } @@ -133,6 +133,7 @@ article pre.codeblock { padding:.5rem; white-space: pre-wrap; border-radius: .25 .binary-container_with-video video, .binary-container_with-audio audio {width: 100%} +.subhyphae__title { padding-bottom: .5rem; } .navi-title { padding-bottom: .5rem; margin: .25rem 0; } .navi-title a {text-decoration:none; } .navi-title__separator { margin: 0 .25rem; } @@ -172,18 +173,20 @@ table { border: #ddd 1px solid; border-radius: .25rem; min-width: 4rem; } td { padding: .25rem; } caption { caption-side: top; font-size: small; } +.subhyphae__list, .subhyphae__list ul { display: flex; padding: 0; margin: 0; flex-wrap: wrap; } +.subhyphae__entry { list-style-type: none; border: 1px solid #999; padding: 0; margin: .125rem; border-radius: .25rem; } +.subhyphae__link { display: block; padding: .25rem; text-decoration: none; } +.subhyphae__link:hover { background: #eee; } + .navitree { padding: 0; margin: 0; } -.navitree__trunk ul { padding-left: 1rem; } -.navitree > .navitree__trunk > ul { padding-left: 2rem; } .navitree__entry { } .navitree > .navitree__entry > a::before { display: inline-block; width: .5rem; color: #999; margin: 0 .25rem; } .navitree > .navitree__entry_infertile > a::before { content: " "} /* nbsp, careful */ .navitree > .navitree__sibling_fertile > a::before { content: "▸"} -.navitree > .navitree__trunk_fertile > a::before { content: "▾"} .navitree__trunk { border-left: 1px #999 solid; } -.navitree > .navitree__trunk { border-left: none; } -.navitree > .navitree__trunk > a { font-weight: bold; } .navitree__link { text-decoration: none; display: block; padding: .25rem; } +.navitree__entry_this > span { display: block; padding: .25rem; font-weight: bold; } +.navitree__entry_this > span::before { content: " "; display: inline-block; width: 1rem; } /* Color stuff */ diff --git a/templates/common.qtpl b/templates/common.qtpl index 1109b93..6b094d1 100644 --- a/templates/common.qtpl +++ b/templates/common.qtpl @@ -1,4 +1,5 @@ {% import "net/http" %} +{% import "strings" %} {% import "github.com/bouncepaw/mycorrhiza/user" %} {% import "github.com/bouncepaw/mycorrhiza/util" %} @@ -73,3 +74,16 @@ var navEntries = []navEntry{ {% endfunc %} + +{% func subhyphaeMatrix(subhyphae string) %} +{% if strings.TrimSpace(subhyphae) != "" %} +
+

Subhyphae

+ +
+{% endif %} +{% endfunc %} diff --git a/templates/common.qtpl.go b/templates/common.qtpl.go index 209e68e..788b784 100644 --- a/templates/common.qtpl.go +++ b/templates/common.qtpl.go @@ -8,27 +8,30 @@ package templates import "net/http" //line templates/common.qtpl:2 -import "github.com/bouncepaw/mycorrhiza/user" +import "strings" //line templates/common.qtpl:3 +import "github.com/bouncepaw/mycorrhiza/user" + +//line templates/common.qtpl:4 import "github.com/bouncepaw/mycorrhiza/util" // This is the