Bjørn Erik Pedersen
941b4caf57
tpl: Add Copyright reference to the Go authors
...
Also a reference to the `index`issue in Go's issue tracker.
2016-03-10 21:00:53 +01:00
Cameron Moore
2d0650dbd9
tpl: Add custom index function
...
This commit adds a custom index template function that deviates from the stdlib
simply by not returning an "index out of range" error if an array, slice or
string index is out of range. Instead, we just return nil values. This should
help make the new default function more useful for Hugo users.
Fixes #1949
2016-03-10 17:47:59 +01:00
Cameron Moore
f3f9763afd
tpl: Add time note to default func description
2016-03-10 17:47:59 +01:00
Cameron Moore
09c8c17bf0
tpl: fix default function
...
This commit fixes a few things:
1. `given` is now a variadic parameter so that piping works properly
2. add separate template tests to make sure piping works
3. support time values
4. add more tests of the dfault function
2016-03-10 17:47:59 +01:00
Cameron Moore
ce9ee3cf49
tpl: Add default function
2016-03-10 17:47:59 +01:00
digitalcraftsman
94c3825e5b
Add md5 and sha1 template funcs
2016-03-10 11:03:06 +01:00
Bjørn Erik Pedersen
a2abad9677
Add support for Go 1.6 block keyword in templates
...
NOTE: Needs Go 1.6 to use the new feature.
Fixes #1832
2016-03-10 10:53:54 +01:00
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