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

Viewutil: Introduce CopyEnRuWith

Reducing boilerplate as usual
This commit is contained in:
Timur Ismagilov
2022-05-18 19:58:24 +03:00
parent 9a540ba022
commit 5bc704b404
8 changed files with 33 additions and 62 deletions

View File

@@ -5,12 +5,10 @@ import (
"github.com/bouncepaw/mycomarkup/v4"
"github.com/bouncepaw/mycorrhiza/shroom"
"github.com/bouncepaw/mycorrhiza/viewutil"
"github.com/gorilla/mux"
"io"
"net/http"
"strings"
"text/template"
"github.com/gorilla/mux"
"github.com/bouncepaw/mycomarkup/v4/mycocontext"
)
@@ -46,9 +44,7 @@ var (
func InitHandlers(r *mux.Router) {
r.PathPrefix("/help").HandlerFunc(handlerHelp)
chain = viewutil.
En(viewutil.CopyEnWith(fs, "view_help.html")).
Ru(template.Must(viewutil.CopyRuWith(fs, "view_help.html").Parse(ruTranslation)))
chain = viewutil.CopyEnRuWith(fs, "view_help.html", ruTranslation)
}
// handlerHelp gets the appropriate documentation or tells you where you (personally) have failed.