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

Upper case .Site.Params has stopped working #1129

Closed
bep opened this issue May 11, 2015 · 5 comments · Fixed by #2717 or #2630
Closed

Upper case .Site.Params has stopped working #1129

bep opened this issue May 11, 2015 · 5 comments · Fixed by #2717 or #2630
Assignees
Milestone

Comments

@bep
Copy link
Member

bep commented May 11, 2015

So ISO8601doesn't work anymore. This is widely used, so this is a site-breaking change.

@bep bep self-assigned this May 11, 2015
@bep
Copy link
Member Author

bep commented May 11, 2015

Breaking commit:
spf13/viper@8d9577a

@bep
Copy link
Member Author

bep commented May 11, 2015

@spf13 not sure whats the correct medicine here ...

There is

func (s *SiteInfo) GetParam(key string) interface{} {
    v := s.Params[strings.ToLower(key)]

But then the Params map is also exported ... No way to fix this without breaking stuff.

@bep bep removed their assignment May 11, 2015
@tatsushid
Copy link
Contributor

Moving SiteInfo.Params to function call is also impossible because isset .Params "key" or index .Params "key" idioms are used widely. As @bep mentioned, there isn't a way to fix without breaking I think.

bep added a commit to spf13/viper that referenced this issue May 11, 2015
This reverts commit 8d9577a.

The commit is reasonable enough, but this is a major breaking change for Hugo.

We have to figure out how to handle this before we introduce this one.

See gohugoio/hugo#1129
@bep
Copy link
Member Author

bep commented May 11, 2015

For now, I have reverted the Viper commit -- we have to think this through, me think.

spf13/viper@be782f3

@anthonyfok anthonyfok added this to the v0.15 milestone Sep 16, 2015
@anthonyfok anthonyfok modified the milestones: v0.16, v0.15 Nov 30, 2015
@bep bep modified the milestones: future, v0.16 May 7, 2016
bep added a commit that referenced this issue Oct 24, 2016
@bep bep self-assigned this Oct 24, 2016
@bep bep removed the priority/P0 label Oct 24, 2016
@bep bep modified the milestones: v0.18, future Oct 24, 2016
bep added a commit to bep/hugo that referenced this issue Nov 22, 2016
There are currently several Params and case related issues floating around in Hugo.

This is very confusing for users and one of the most common support questions on the forum.

And while there have been done some great leg work in Viper etc., this is of limited value since this and similar doesn't work:

`Params.myCamelCasedParam`

Hugo has control over all the template method invocations, and can take care of all the lower-casing of the map lookup keys.

But that doesn't help with direct template lookups of type `Site.Params.TWITTER_CONFIG.USER_ID`.

This commit solves that by doing some carefully crafted modifications of the templates' AST -- lowercasing the params keys.

This is low-level work, but it's not like the template API wil change -- and this is important enough to defend such "bit fiddling".

Tests are added for all the template engines: Go templates, Ace and Amber.

Fixes gohugoio#2615
Fixes gohugoio#1129
Fixes gohugoio#2590
@bep bep closed this as completed in #2630 Nov 22, 2016
bep added a commit that referenced this issue Nov 22, 2016
There are currently several Params and case related issues floating around in Hugo.

This is very confusing for users and one of the most common support questions on the forum.

And while there have been done some great leg work in Viper etc., this is of limited value since this and similar doesn't work:

`Params.myCamelCasedParam`

Hugo has control over all the template method invocations, and can take care of all the lower-casing of the map lookup keys.

But that doesn't help with direct template lookups of type `Site.Params.TWITTER_CONFIG.USER_ID`.

This commit solves that by doing some carefully crafted modifications of the templates' AST -- lowercasing the params keys.

This is low-level work, but it's not like the template API wil change -- and this is important enough to defend such "bit fiddling".

Tests are added for all the template engines: Go templates, Ace and Amber.

Fixes #2615
Fixes #1129
Fixes #2590
bep added a commit to bep/hugo that referenced this issue Nov 22, 2016
There are currently several Params and case related issues floating around in Hugo.

This is very confusing for users and one of the most common support questions on the forum.

And while there have been done some great leg work in Viper etc., this is of limited value since this and similar doesn't work:

`Params.myCamelCasedParam`

Hugo has control over all the template method invocations, and can take care of all the lower-casing of the map lookup keys.

But that doesn't help with direct template lookups of type `Site.Params.TWITTER_CONFIG.USER_ID`.

This commit solves that by doing some carefully crafted modifications of the templates' AST -- lowercasing the params keys.

This is low-level work, but it's not like the template API wil change -- and this is important enough to defend such "bit fiddling".

Tests are added for all the template engines: Go templates, Ace and Amber.

Fixes gohugoio#2615
Fixes gohugoio#1129
Fixes gohugoio#2590
bep added a commit that referenced this issue Nov 22, 2016
There are currently several Params and case related issues floating around in Hugo.

This is very confusing for users and one of the most common support questions on the forum.

And while there have been done some great leg work in Viper etc., this is of limited value since this and similar doesn't work:

`Params.myCamelCasedParam`

Hugo has control over all the template method invocations, and can take care of all the lower-casing of the map lookup keys.

But that doesn't help with direct template lookups of type `Site.Params.TWITTER_CONFIG.USER_ID`.

This commit solves that by doing some carefully crafted modifications of the templates' AST -- lowercasing the params keys.

This is low-level work, but it's not like the template API wil change -- and this is important enough to defend such "bit fiddling".

Tests are added for all the template engines: Go templates, Ace and Amber.

Fixes #2615
Fixes #1129
Fixes #2590
tychoish pushed a commit to tychoish/hugo that referenced this issue Aug 13, 2017
@github-actions
Copy link

This issue 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 Mar 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants