mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-17 21:01:26 +02:00
hugolib: Do not tolower result from Page.GetParam
We still do lowering of the param strings in some internal use of this, but the exported `GetParam` method is changed to a more sensible default. This was used for the `disqus_title` etc. in the internal Disqus template, which was obviously not right. If you really want to lowercase your params, do it with `.GetParam "myparam" | lower` or similar. Fixes #4187
This commit is contained in:
@@ -1067,22 +1067,22 @@ func TestDifferentFrontMatterVarTypes(t *testing.T) {
|
||||
_, _ = page.ReadFrom(strings.NewReader(pageWithVariousFrontmatterTypes))
|
||||
|
||||
dateval, _ := time.Parse(time.RFC3339, "1979-05-27T07:32:00Z")
|
||||
if page.GetParam("a_string") != "bar" {
|
||||
t.Errorf("frontmatter not handling strings correctly should be %s, got: %s", "bar", page.GetParam("a_string"))
|
||||
if page.getParamToLower("a_string") != "bar" {
|
||||
t.Errorf("frontmatter not handling strings correctly should be %s, got: %s", "bar", page.getParamToLower("a_string"))
|
||||
}
|
||||
if page.GetParam("an_integer") != 1 {
|
||||
t.Errorf("frontmatter not handling ints correctly should be %s, got: %s", "1", page.GetParam("an_integer"))
|
||||
if page.getParamToLower("an_integer") != 1 {
|
||||
t.Errorf("frontmatter not handling ints correctly should be %s, got: %s", "1", page.getParamToLower("an_integer"))
|
||||
}
|
||||
if page.GetParam("a_float") != 1.3 {
|
||||
t.Errorf("frontmatter not handling floats correctly should be %f, got: %s", 1.3, page.GetParam("a_float"))
|
||||
if page.getParamToLower("a_float") != 1.3 {
|
||||
t.Errorf("frontmatter not handling floats correctly should be %f, got: %s", 1.3, page.getParamToLower("a_float"))
|
||||
}
|
||||
if page.GetParam("a_bool") != false {
|
||||
t.Errorf("frontmatter not handling bools correctly should be %t, got: %s", false, page.GetParam("a_bool"))
|
||||
if page.getParamToLower("a_bool") != false {
|
||||
t.Errorf("frontmatter not handling bools correctly should be %t, got: %s", false, page.getParamToLower("a_bool"))
|
||||
}
|
||||
if page.GetParam("a_date") != dateval {
|
||||
t.Errorf("frontmatter not handling dates correctly should be %s, got: %s", dateval, page.GetParam("a_date"))
|
||||
if page.getParamToLower("a_date") != dateval {
|
||||
t.Errorf("frontmatter not handling dates correctly should be %s, got: %s", dateval, page.getParamToLower("a_date"))
|
||||
}
|
||||
param := page.GetParam("a_table")
|
||||
param := page.getParamToLower("a_table")
|
||||
if param == nil {
|
||||
t.Errorf("frontmatter not handling tables correctly should be type of %v, got: type of %v", reflect.TypeOf(page.Params["a_table"]), reflect.TypeOf(param))
|
||||
}
|
||||
|
Reference in New Issue
Block a user