Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add template functions as html render option #81

Merged
merged 2 commits into from
Apr 21, 2020

Conversation

brutella
Copy link
Contributor

@brutella brutella commented Apr 6, 2020

This change adds the field Funcs to the HTMLOptions struct to specify additional functions for every html rendering.

I use it to specify a translation function T to localize text.
Since every html request needs a different translation function T (because users have different language settings), I have to specify it for every html page rendering.

I've also changed the value type of Options.Funcs from []template.FuncMap to template.FuncMap.
I couldn't find any reason why it has to be a slice – or do I miss something obvious?

@brutella
Copy link
Contributor Author

I still feel like the Funcs option should be of type template.FuncMap instead of a []template.FuncMap.

Are there any plans to release a new major version, where this breaking change could be introduced? Should I create a separate issue to track that?

(I'm still thankful for this library though. ❤️)

@unrolled
Copy link
Owner

This looks good, thanks for the contribution! No plans on a new major version yet, but I've got a document tracking breaking change requests now 😉

@unrolled unrolled merged commit b7b4713 into unrolled:master Apr 21, 2020
@brutella brutella deleted the master branch April 21, 2020 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants