Upper case .Site.Params has stopped working #1129

Closed
bep opened this Issue May 11, 2015 · 4 comments

Comments

Projects
None yet
3 participants
@bep
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

This comment has been minimized.

Show comment
Hide comment
@bep

bep May 11, 2015

Member

Breaking commit:
spf13/viper@8d9577a

Member

bep commented May 11, 2015

Breaking commit:
spf13/viper@8d9577a

@bep

This comment has been minimized.

Show comment
Hide comment
@bep

bep May 11, 2015

Member

@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.

Member

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

This comment has been minimized.

Show comment
Hide comment
@tatsushid

tatsushid May 11, 2015

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.

Contributor

tatsushid commented May 11, 2015

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

Revert "Recursively insensitivize the configuration structures"
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

This comment has been minimized.

Show comment
Hide comment
@bep

bep May 11, 2015

Member

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

spf13/viper@be782f3

Member

bep commented May 11, 2015

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

spf13/viper@be782f3

@FranklinChen FranklinChen referenced this issue in zyro/hyde-x May 12, 2015

Closed

Disqus support is missing #24

@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

Fix case issues with Params
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 bep closed this in #2630 Nov 22, 2016

bep added a commit that referenced this issue Nov 22, 2016

Fix case issues with Params
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

Fix case issues with Params
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 that referenced this issue Nov 22, 2016

Fix case issues with Params
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 added a commit to tychoish/hugo that referenced this issue Aug 13, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment