A word on function naming #7
Locked
regisphilibert
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
It would be great if Hugo could already supports template function definitions (TDF) so we don't have to rely on the
partial
api to call functions.In this document we'll assume we can use TDF which supports multiple arguments (contrary to partials)
Example with tnd-styles/tags
Potential syntax for a function printing style tags which would serve the same purpose as TND Styles's tags
with TDF
The following is my number one preference but will not be possible with simple tdf because of their obvious name limitations:
{{ huge.styles.tags param1 param2 }}
Too bad we'll have to settle with the following:
{{ huge_styles_tags param1 param2 }}
I would be ready to forgo of the fear of ambiguity and just simplify our function names: "styles"
{{ styles param1 param1 }}
But if Hugo core drops a new function called
styles
in the near future we would be in big trouble...without TDF
{{ partial "huge/styles/tags" (dict "param1" "param1_value" "param2" "param2_value") }}
Beta Was this translation helpful? Give feedback.
All reactions