From be7404e3371caa2851111bb3bcdc1c26f7ed47f5 Mon Sep 17 00:00:00 2001 From: bep Date: Thu, 28 May 2015 23:05:13 +0200 Subject: Support `Fish and Chips` section Section names are also used as the title of the list pages, but naming section folders as `Fish and Chips` and similar didn't work very well. This commit fixes that. This commit also changes the title casing of the section titles. Some may argue that this is a breaking change, but the old behaviour was also pretty broken, even for languages that use title capitalizations, as it didn't follow any particular style guide, `fish and chips` became `Fish And Chips` etc. Now it just turns the first letter into upper case, so `Fish and Chips` will be left as `Fish and Chips`. People wanting the good old behaviour can use the `title` template func. Fixes #1176 --- helpers/general_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'helpers/general_test.go') diff --git a/helpers/general_test.go b/helpers/general_test.go index 31c478200..c801ad441 100644 --- a/helpers/general_test.go +++ b/helpers/general_test.go @@ -33,6 +33,24 @@ func TestGuessType(t *testing.T) { } } +func TestFirstUpper(t *testing.T) { + for i, this := range []struct { + in string + expect string + }{ + {"foo", "Foo"}, + {"foo bar", "Foo bar"}, + {"Foo Bar", "Foo Bar"}, + {"", ""}, + {"å", "Å"}, + } { + result := FirstUpper(this.in) + if result != this.expect { + t.Errorf("[%d] got %s but expected %s", i, result, this.expect) + } + } +} + func TestBytesToReader(t *testing.T) { asBytes := ReaderToBytes(strings.NewReader("Hello World!")) asReader := BytesToReader(asBytes) -- cgit v1.2.3