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

WIP tpl: Add TemplateFuncsNamespaceRegistry #3415

Merged
merged 16 commits into from
May 1, 2017
Merged

Conversation

bep
Copy link
Member

@bep bep commented Apr 30, 2017

As a first step to remove the hard ties between tplimpl and the different namespace packages.

The lang package is used as the first example use case.

See #3042

/cc @moorereason

As a first step to remove the hard ties between `tplimpl` and the different namespace packages.

The `lang` package is used as the first example use case.

See gohugoio#3042
@bep
Copy link
Member Author

bep commented Apr 30, 2017

@moorereason I will wrap this up tomorrow sometime, but if you can look at the test cases left:

https://github.com/bep/hugo/blob/4f37573810762be608fb74e03d2c5d2b5cca17a3/tpl/tplimpl/template_funcs_test.go#L129

And ignore the obvious ones (the few I have not moved). Where do the rest belong.

  • printf etc. new package fmt I assume?
  • urlize ... in urls?
  • htmlUnescape etc.?
  • dateFormat

Also these:

https://github.com/bep/hugo/blob/b55f4713621dfd7de6a3ca13202252daa428907a/tpl/tplimpl/template_funcs.go#L96

@moorereason
Copy link
Contributor

  • htmlEscape and htmlUnescape are in transform.
  • dateFormat is time.Format.
  • A fmt namespace sounds appropriate. 👍
  • urls.Urlize 👍
  • For string and int, do we add a reflect namespace? Don't know why it would be necessary at this point, but we could have methods for many types ([u]int[8|16|32|64], float[32], ...).
  • partial* to new templates namespace?

@bep
Copy link
Member Author

bep commented May 1, 2017

@moorereason if you're up and about: The only thing left now is some badly named partials methods. Suggestions?

@bep
Copy link
Member Author

bep commented May 1, 2017

Never mind; I name it partials.Include -- and then handle the cache variant in #3417

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants