Thanks. I don't know what kind of goals you are trying to achieve, but here are mine:
What I'm trying to do is to modulelize customized Go template functions, say one module provide advanced regexp support, while another one specialized in text formatting (vertical aligning, text folding in column, etc), so on and so forth, *each of the module has a collection of their own customized template functions*. The goal is to define such modules separately, as a building block, provide them as libraries, and the end user can pick and choose what what, and chain the customized template functions together using a series of `.Funcs` calls. Thus, I was trying to wrap the myFuncMap into a callable function, so that the library works for both text and html templates. So how is the following fitting into the above goals? Thx. On Sat, Jul 15, 2017 at 12:51 PM, Matt Ho <matt...@gmail.com> wrote: > Given that text and html templates are separate calls anyways, why not > just make separate calls for your custom funcmap? For example: > > package template > > import ( > html "html/template" > text "text/template" > ) > > func Html(name string, fm html.FuncMap) *html.Template { > return html.New(name).Funcs(fm) > } > > func Text(name string, fm text.FuncMap) *text.Template { > return text.New(name).Funcs(fm) > } > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.