Commit graph

8 commits

Author SHA1 Message Date
Ariejan de Vroom 0a2e5424ab Add last template function
`last` allows the user to select the last X items of
and array.
2015-06-15 21:18:38 +02:00
Ariejan de Vroom c335efdd06 Add after template function
Where `first` will return the first N items of a rangeable list,
`after` will return all items after the Nth item.

This allows the user to do something with the first N items and
something different with the remaining items after N.
2015-06-15 21:18:38 +02:00
Tatsushi Demachi 51cabe6faf Fix substr tpl func's int type variant issue
`substr` template function takes one or two range arguments. Both
arguments must be int type values but if it is used with a calclation
function e.g. `add`, `len` etc, it causes a wrong type error.

This fixes the issue to allow the function to take other integer type
variant like `int64` etc.

This also includes a small fix on no range argument case.

Fix #1190
2015-06-06 21:03:30 +02:00
Tatsushi Demachi 601a2ce124 Add time.Time type support to where tpl func
`where` tpl function doesn't support `time.Time` type so if people want
to compare such values, it's required that these values are converted
into `int` and compare them.

This improves it. If `time.Time` values are passed to `where`, it
converts them into `int` internally, compares them and returns the
result.

See also
http://discuss.gohugo.io/t/future-posts-and-past-posts/1229/3
2015-05-26 15:59:36 +02:00
bep befb54da46 Apply gofmt -s 2015-05-25 12:54:13 +02:00
bep a52e508d46 Update test logs for uniformity and consistency
Many minor fixes to make test logs more consistent and correct a
mispelling.

Standardize on "[%i] got X but expected Y" for log messages. Using
a consistent layout makes it easier to read the test results. This
was mostly changing "Got" to "got". Swapped the order of values on
several calls to bring them in line with the convention.

A few log messages had a sequence number added to identify the
exact scenario that failed. Otherwise, there would be no way to
ascertain which failed When there are many scenarios.

Correct spelling of "expected."

Fixes #1028
Merged be2097e1ad

[close #1040]
2015-05-08 22:27:00 -04:00
bep be017f187e tpl: check slice bounds in slicestr
Fixes #1090
2015-04-30 11:26:45 +02:00
bep be2097e1ad tpl: split template.go
The template funcs get their own file. This prevents having to scroll miles to get to the template infrastructure.
2015-04-05 21:03:12 +02:00