Commit graph

191 commits

Author SHA1 Message Date
Bjørn Erik Pedersen 973393c99e Create template clone for late template execution
Fixing some breaking blogs on Go 1.6

Fixes #1879
2016-03-09 14:37:58 +01:00
Bjørn Erik Pedersen 435e996c4f Add jsonify template func 2016-03-06 15:01:14 +01:00
Bjørn Erik Pedersen d774b142e8 Make where accept slice
Fixes #1926
2016-03-06 13:15:07 +01:00
Bjørn Erik Pedersen 3c100cc32c tpl: Unexport the rest of the internal template funcs 2016-03-04 01:00:41 +01:00
Bjørn Erik Pedersen f6591eca35 tpl: Add some dateFormat testcases with both time and date
See #235
2016-03-03 23:17:35 +01:00
Bjørn Erik Pedersen e85b821d3e tpl: Fix broken chomp test 2016-03-03 21:24:21 +01:00
Bjørn Erik Pedersen f223f17c76 tpl: Make chomp return template.HTML 2016-03-03 19:45:23 +01:00
Bjørn Erik Pedersen daaf4eb330 tpl: Add integration tests for most of the template funcs examples in doc 2016-03-03 19:35:04 +01:00
Bjørn Erik Pedersen 6b922750f3 Revert "Create template clone for late template execution"
This reverts commit 93b04e67f6.
2016-02-28 12:15:33 +01:00
Bjørn Erik Pedersen 93b04e67f6 Create template clone for late template execution
Fixing some breaking blogs on Go 1.6

Fixes #1879
2016-02-28 11:51:51 +01:00
digitalcraftsman c1f8b188f7 Add template function slice 2016-02-27 17:04:45 +01:00
David Roda 284e959fc4 Close file handle when finished reading file 2016-02-17 21:42:56 +01:00
Bjørn Erik Pedersen c1e4309516 Clean up the trim template func test 2016-02-16 00:47:14 +01:00
Derek Perkins bac1ba4655 Fix spelling and go vet errors 2016-02-13 19:08:48 +08:00
Bjørn Erik Pedersen 8fe1070872 Prevent confusing template errors when seq is nil
The common is the `where` func and this:

```
panic: reflect: call of reflect.Value.Type on zero Value [recovered]
	panic: reflect: call of reflect.Value.Type on zero Value
```
2016-02-09 19:02:05 +01:00
Bjørn Erik Pedersen 2b0fad79b7 tpl: Add two more doArithmetic test cases 2016-02-07 23:02:46 +01:00
Bjørn Erik Pedersen f90b45f7f3 tpl: Test with nil value in first, last, after and shuffle 2016-02-07 21:16:43 +01:00
Bjørn Erik Pedersen 3cc468a82f tpl: Add missing test variants for slicestr 2016-02-07 20:14:24 +01:00
Bjørn Erik Pedersen b3c2d90ba2 tpl: Add missing substr test variants 2016-02-07 15:22:57 +01:00
Bjørn Erik Pedersen 4dcb63c2f6 tpl: Add highlight test 2016-02-07 15:15:27 +01:00
Bjørn Erik Pedersen 0a8583a451 tpl: Add missing base64 tests 2016-02-07 14:58:23 +01:00
Bjørn Erik Pedersen 0888ddd01f tpl: Add tests for word and rune counting 2016-02-07 14:51:06 +01:00
Bjørn Erik Pedersen ec49dbb8f5 tpl: Consolidate and complete the Inflect tests 2016-02-07 14:37:04 +01:00
Bjørn Erik Pedersen 1e8b4d9cde Add some missing doArithmetic test cases 2016-02-07 14:20:25 +01:00
Bjørn Erik Pedersen 5995eaaa08 tpl: Unexport all template funcs
There is no good reason to export all the template funcs:

* They're not used outside the templates.
* If usable in other packages, they should be moved (to helpers?)
* They create too broad an interface;
  users of the tpl package don't see the forest for all the trees.
2016-02-07 11:45:45 +01:00
Bjørn Erik Pedersen 0586bf0dc3 Use filepath.Join in locale resource getting 2016-02-07 02:12:33 +01:00
Bjørn Erik Pedersen 8d8e9dde51 Minor cleanup of some of the resource getting code 2016-02-07 02:07:58 +01:00
Bjørn Erik Pedersen b3a70abe40 tpl: Complete coverage for Humanize 2016-02-07 01:45:37 +01:00
Cameron Moore 45df4596bb tpl: Add humanize func and cleanup lint
Add humanize (inflect.Humanize) to the template funcMap.  Documentation and
tests are included.

Various code cleanups of the template funcs:

- Break pluralize and singularize out into stand-alone funcs.
- Sort the list of funcMap entries.
- Add some minimal godoc comments to all public funcs.
- Fix some issues found by golint and grind.
2016-02-06 15:31:25 +01:00
Bjørn Erik Pedersen 318a984526 Apply gofmt -s 2016-02-06 13:09:52 +01:00
digitalcraftsman cd36d752a3 Add autostart option to YouTube shortcode 2016-01-29 16:23:41 -05:00
Tatsushi Demachi 3b3e771d61 Check for exported fields in embedded structs
This fixes a exported field check condition in a way described at Go
issue https://golang.org/issue/12367

According to the issue comments, this fix should be safe under Go 1.6.
2016-01-28 19:27:35 +09:00
Bjørn Erik Pedersen 75ba84acbf Add int and string cast template funcs 2016-01-15 23:56:45 +01:00
Bjørn Erik Pedersen e8ca52e93a Add one more temporary template test for linux/arm
See #1771
2016-01-13 14:26:25 +01:00
Bjørn Erik Pedersen bca2d38e52 Add temporary template test for linux/arm
See #1771
2016-01-13 14:10:14 +01:00
Ivan Fraixedes 9a6dc6c791 Add embeded template for robots.txt 2016-01-05 23:36:16 +01:00
Daniel Martí 7c5a1fd16b Replace *bytes.Buffer with io.Writer in rendering
Found via github.com/mvdan/interfacer.
2016-01-05 23:32:03 +01:00
Antti Järvinen 9008ac0b55 Rename random to shuffle. Remove count parameteter to simplify its role. Add tests for randomising. 2016-01-04 11:47:37 -05:00
Antti Järvinen 302a6ac701 Add Random function to template functions
Adds Random function to pick N random items from sequence.
2016-01-04 11:38:57 -05:00
Wade Fitzpatrick ff28120e53 Added async version of Google Analytics internal template 2016-01-04 10:33:18 -05:00
digitalcraftsman dfa34afd86 Add template funcs countwords and countrunes 2016-01-02 11:00:03 -05:00
Colin Bate 2e92f36890 Add hasPrefix template function. 2016-01-02 10:47:17 -05:00
Bjørn Erik Pedersen fe7ca7d78c Fix build 2015-12-18 23:23:37 +01:00
Bjørn Erik Pedersen 13d14ab94d Remove "Host:" prefix from Host header
That thould work with Go 1.4.3 according to sources inside Google.
2015-12-18 23:09:50 +01:00
Bjørn Erik Pedersen dd2ab2820e Correct the strings.Contains syntax in failing test 2015-12-18 16:19:00 +01:00
Bjørn Erik Pedersen 31035f8ad1 Fix remote test on Go 1.4 2015-12-18 16:05:24 +01:00
Bjørn Erik Pedersen 89f8fa586c Set the request Host on http test server
Needed for the remote tests to pass on Go 1.6.

See #1470
2015-12-18 15:52:17 +01:00
Anthony Fok 8509727fe8 Add copyright header to that source files that don’t have one.
See #1646
2015-12-10 15:19:38 -07:00
Tatsushi Demachi f3c74c9db4 Add boolean value comparison to where tpl function
`where` template function's internal condition check function doesn't
check boolean values and always returns `false` silently.

This adds missing boolean value comparison to the function.
`where Values ".Param.key" true` like clause can be used.

Only "=", "==", "eq", "!=", "<>", "ne" operators are allowed to be used
with a boolean value. If an other operator is passed with it, the
condition check function returns `false` like before.
2015-12-08 05:39:11 +09:00
Bjørn Erik Pedersen e445c35d6a Fix copyright headers in source files
Still need to add some missing headers and an AUTHORS file.

See #1646
2015-12-07 19:57:01 +01:00