Commit graph

152 commits

Author SHA1 Message Date
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
digitalcraftsman
311307c9e4 Add IsNamedParams property in shortcodes 2015-11-24 08:59:32 +01:00
digitalcraftsman
7d31d5f59d Add shortcode for tweets 2015-11-24 08:59:32 +01:00
digitalcraftsman
e03f27ccf8 Add shortcode for github gists 2015-11-24 08:59:32 +01:00
digitalcraftsman
3027b15176 Add shortcode for vimeo 2015-11-24 08:59:32 +01:00
digitalcraftsman
4424288d9b Add shortcode for youtube 2015-11-24 08:59:32 +01:00
digitalcraftsman
cc3f52b9c1 Add shortcode for speakerdeck 2015-11-24 08:59:31 +01:00
Steve Francia
f045d7a611 Change the license to Apache 2.0 2015-11-23 22:16:36 -05:00
Marek Janda
afbd52f78e Apply absURL on social tag urls 2015-11-20 23:36:48 +01:00
Cameron Moore
c5a4c07b89 Add SafeJS template function
This commit adds a SafeJS template function.  Tests and documentation are
included.

Fixes #1579
2015-11-20 21:12:01 +01:00
Bjørn Erik Pedersen
35abd179e2 Add time.Time support in ge, gt, le, lt
Fixes #1593
2015-11-20 11:53:25 +01:00
Anthony Fok
18a29964fa Fix trivial typos in code 2015-11-16 07:15:17 -07:00
spf13
619c16fd03 re-simplify SafeHTML function 2015-11-15 11:10:35 -05:00
spf13
062f6c3383 rewrite safeHTML function 2015-11-15 11:05:16 -05:00
digitalcraftsman
9dbb6dc50d Add internal Google Analytics template
This commits also adds the GoogleAnalytics
variable to insert the tracking code.

Fixes #1424.
2015-11-04 17:11:38 -05:00
Bjørn Erik Pedersen
4c04d7101a Fix In func given an []interface{}
Fixes #1486
2015-10-13 17:05:36 +02:00
Bjørn Erik Pedersen
17fb752279 Correct number of args to Errorf 2015-10-12 21:34:15 +02:00
Bjørn Erik Pedersen
72f14a8202 Apply project wide go fmt 2015-10-12 20:47:06 +02:00
NotZippy
3a27cefec1 Add dictionary function to be passed into a template
Allows templates to dynamically build maps.

Example usage: Creating and passing a map to a subtemplate while in a range on the parent.
2015-10-09 18:29:16 +02:00
digitalcraftsman
79f8bb625d Add base64Decode and base64Encode template functions
Fixes #1416
2015-09-25 21:31:55 +02:00
Bjørn Erik Pedersen
8d695ec592 Add singularize template func
See #1438
2015-09-22 22:31:02 +02:00
Bjørn Erik Pedersen
751d4906ef Add pluralize template func
Fixes #1438
2015-09-22 22:25:25 +02:00
Bjørn Erik Pedersen
dac9c0dae6 Use cast.ToIntE for int conversions in substr and slicestr
It is less restrictive, and it is what is used in other template funcs.
2015-08-15 15:47:16 +02:00
Benny Wu
5b51b3b9fb Slicestr fix for other int type param
Fixes #1347
2015-08-14 17:26:30 +02:00
Bjørn Erik Pedersen
cea82842f0 Rename ReadDir to readDir
To make it consistent with the other template funcs.
2015-08-07 14:33:48 +02:00
Tatsushi Demachi
153332706a Make sort tpl func accept field/key chaining arg
'sort' template function used to accept only each element's struct field
name, method name and map key name as its second argument. This extends
it to accept a field/method/key chaining key string like
'Params.foo.bar' as the argument. It evaluates sub elements of each
array or map elements and sorts by them.

Typical use case would be sorting pages by user defined front matter
value. For example, sorting pages by 'Params.foo.bar' is possible by
writing the following template code

    {{ range sort .Data.Pages "Params.foo.bar" }}
        {{ .Content }}
    {{ end }}

It ignores all leading and trailing dots so "Params.foo.bar" can be
written in ".Params.foo.bar"

This also fixes the issue that 'sort' cannot evaluate a pointer value.

Fix #1330
2015-08-07 14:06:06 +02:00
Tatsushi Demachi
56534beaf6 Fix sort tpl func to return explicit type value
sort template function returns `[]interface{}` type slice value
regardless of its original element type.

This fixes it to keep the original element type. For example, if it
sorts `map[string]int` type value, it returns `[]int` slice value
instead of `[]interface{}` slice value.
2015-08-07 14:06:06 +02:00
Bjørn Erik Pedersen
c7aa881d90 Fix Unicode issue in Slicestr and Substr
Fixes #1333
2015-08-07 08:52:22 +02:00
Bjørn Erik Pedersen
1583d8d094 Add missing formatting directive in Printf call
To make Go Vet happy.
2015-08-06 22:46:35 +02:00
Bjørn Erik Pedersen
0b7229f7b2 Add some float tests to TestArethmic 2015-08-05 18:55:25 +02:00
Anthony Fok
252ea96d1d Remove deprecated fields and methods for v0.15
Special thanks to @bep for his guidance and
for making sure all of the Hugo themes get updated.

Fixes #1172
2015-07-30 13:33:38 +02:00
Russell Oliver
81e69c416d Add ReadDir function to list local files.
Includes documentation.
2015-07-25 21:56:38 +02:00
Scott C Wilson
8a48412c44 On error, return error message, not nil 2015-07-20 14:49:21 +02:00
Tatsushi Demachi
03a7016104 Let Amber template call Hugo's custom functions
Amber doesn't share text/template `FuncMap` functions and has its own
function list. This allows Amber to call Hugo's custom functions.
2015-07-20 11:29:15 +02:00
Bjørn Erik Pedersen
e3ea4b48a2 Fix name logic for Amber templates 2015-07-19 20:12:05 +02:00
Tatsushi Demachi
dd732e84f4 Add nil comparison to where tpl function
`where` template function's internal condition check function always
returns `false` when a target value doesn't exist or it's nil value but
this behavior makes it difficult to filter values which doesn't have a
particular parameter.

To solve it, this adds nil value comparison to the function.
`where Values ".Param.key" nil` like clause can be used for the case
above.

Only "=", "==", "eq", "!=", "<>", "ne" operators are allowed to be used
with `nil`. If an other operator is passed with `nil`, the condition
check function returns `false` like before.

Fix #1232
2015-06-29 19:50:45 +02:00
Jonathan Anderson
c4ad8f6498 Use helpers.GetThemeDir() to find base templates.
Now that we have the helpers.GetThemeDir() function, use it instead of
calling directly into viper.
2015-06-25 18:05:43 +02:00
Jonathan Anderson
0987e98db3 Add support for baseof.ace templates in themes.
When we find a template that requires a base template, we should also look
for that base template in the current theme.

Fixes #1215.
2015-06-25 18:05:43 +02:00
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
627d016cc9 Refactor var name limit to index 2015-06-15 21:18:38 +02:00