1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2025-12-03 07:08:06 +00:00

Turn BodyAttributes into a map

BodyAttributes is now a map of attribute name -> attribute value. This
was done because attribute names have a restricted set of characters,
but attribute values are much less restrictive
This commit is contained in:
kez
2022-08-14 15:36:55 -07:00
committed by Timur Ismagilov
parent e0f2868d34
commit c1946d8849
7 changed files with 22 additions and 25 deletions

View File

@@ -50,7 +50,7 @@ func handlerRemoveMedia(w http.ResponseWriter, rq *http.Request) {
meta,
fmt.Sprintf(lc.Get("ui.ask_remove_media"), util.BeautifulName(h.CanonicalName())),
hypview.RemoveMediaAsk(rq, h.CanonicalName()),
[]string{},
map[string]string{},
))
return
}
@@ -178,7 +178,7 @@ func handlerEdit(w http.ResponseWriter, rq *http.Request) {
meta,
fmt.Sprintf(lc.Get("edit.title"), util.BeautifulName(hyphaName)),
hypview.Editor(rq, hyphaName, textAreaFill, warning),
[]string{}))
map[string]string{}))
}
// handlerUploadText uploads a new text part for the hypha.
@@ -217,7 +217,7 @@ func handlerUploadText(w http.ResponseWriter, rq *http.Request) {
message,
"",
mycomarkup.BlocksToHTML(ctx, mycomarkup.BlockTree(ctx))),
[]string{},
map[string]string{},
))
} else {
http.Redirect(w, rq, "/hypha/"+hyphaName, http.StatusSeeOther)

View File

@@ -50,7 +50,7 @@ func handlerMedia(w http.ResponseWriter, rq *http.Request) {
viewutil.MetaFrom(w, rq),
lc.Get("ui.media_title", &l18n.Replacements{"name": util.BeautifulName(hyphaName)}),
views2.MediaMenu(rq, h, u),
[]string{},
map[string]string{},
))
}
@@ -144,7 +144,7 @@ func handlerRevision(w http.ResponseWriter, rq *http.Request) {
viewutil.MetaFrom(w, rq),
lc.Get("ui.revision_title", &l18n.Replacements{"name": util.BeautifulName(hyphaName), "rev": revHash}),
page,
[]string{},
map[string]string{},
),
)
}
@@ -195,7 +195,7 @@ func handlerHypha(w http.ResponseWriter, rq *http.Request) {
viewutil.MetaFrom(w, rq),
util.BeautifulName(hyphaName),
views2.Hypha(viewutil.MetaFrom(w, rq), h, contents),
[]string{},
map[string]string{},
openGraph))
case hyphae.ExistingHypha:
fileContentsT, errT := os.ReadFile(h.TextFilePath())
@@ -211,17 +211,14 @@ func handlerHypha(w http.ResponseWriter, rq *http.Request) {
contents = mycoopts.Media(h, lc) + contents
}
cats := []string{}
for _, category := range categories.CategoriesWithHypha(h.CanonicalName()) {
cats = append(cats, "cat-" + category)
}
category_list := ":" + strings.Join(categories.CategoriesWithHypha(h.CanonicalName()), ":") + ":"
util.HTTP200Page(w,
viewutil.Base(
viewutil.MetaFrom(w, rq),
util.BeautifulName(hyphaName),
views2.Hypha(viewutil.MetaFrom(w, rq), h, contents),
cats,
map[string]string{"cats": category_list},
openGraph))
}
}