Cameron Moore
b0326a1c0f
tpl: Treat booleans as set in default function
...
Booleans and `default` don't really make sense together, so we'll always treat
booleans as "set" and return the given value.
2016-03-16 20:05:48 +01:00
digitalcraftsman
b5c718a4de
docs: Fix typos in functions.md and contributing.md
2016-03-16 13:04:41 +01:00
Daniel Compton
153dccc0e8
Add debugging steps for no variables defined
2016-03-12 21:44:50 +13:00
Bjørn Erik Pedersen
cafb784799
Add emoji support
...
This uses the Emoji map from https://github.com/kyokomi/emoji -- but with a custom replacement implementation.
The built-in are fine for most use cases, but in Hugo we do care about pure speed.
The benchmarks below are skewed in Hugo's direction as the source and result is a byte slice,
Kyokomi's implementation works best with strings.
Curious: The easy-to-use `strings.Replacer` is also plenty fast.
```
BenchmarkEmojiKyokomiFprint-4 20000 86038 ns/op 33960 B/op 117 allocs/op
BenchmarkEmojiKyokomiSprint-4 20000 83252 ns/op 38232 B/op 122 allocs/op
BenchmarkEmojiStringsReplacer-4 100000 21092 ns/op 17248 B/op 25 allocs/op
BenchmarkHugoEmoji-4 500000 5728 ns/op 624 B/op 13 allocs/op
```
Fixes #1891
2016-03-11 15:51:37 -06:00
Cameron Moore
b8d3651242
tpl: Add replaceRE function
...
This commit addes a `replaceRE` template function. Regexp patterns are compiled
once and cached.
2016-03-11 19:59:18 +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
0743646f32
docs: add better default example
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
435e996c4f
Add jsonify template func
2016-03-06 15:01:14 +01:00
digitalcraftsman
c1f8b188f7
Add template function slice
2016-02-27 17:04:45 +01:00
Paul Koppen
060f0206ee
Docs: remove .Taxonomies from Page variables
...
The property seems to have never existed on Pages.
Fixes #1865 .
2016-02-24 19:22:53 +01:00
Thijs de Zoute
d607f4c7df
Docs: fix small typos in functions.md
2016-02-24 19:14:04 +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
digitalcraftsman
ec02b9908c
Fixed example and cross-reference in content/variables.md
...
Fixed a path in a Page Params example to reflect real directory
structure, removed extra quotes from sample code, and fixed link to
Archetypes which read "cross-references" before.
See #1805
2016-02-01 16:54:27 +01:00
digitalcraftsman
9015aa5b84
Docs: fix some typos in templates/variables.md
2016-01-30 11:12:24 +01:00
Renato Vargas
817d69487c
Expanded the Page Params section in variables.md
...
Expanded on the use of Page Params in the templates/variables.md
documentation. Added sample code for something that keeps coming up on
discuss.github.io
2016-01-30 01:24:55 +01:00
Bjørn Erik Pedersen
58a183c330
Docs: Add doc for string and int
2016-01-16 00:06:32 +01:00
Bjørn Erik Pedersen
01f71babfc
docs: Add lastmod to content files
...
Based on last commit in Git.
2016-01-06 23:55:18 +01:00
Alexandre Bourget
bc48b4606a
Added documentation about variable scoping in "partials".
2016-01-04 12:42:48 -05:00
Alexandre Bourget
8f8120ba14
Added "Caddy server"'s handling of 404 errors.
2016-01-04 12:42:47 -05:00
Gerben Castel
6cdb8109cf
Allow renaming of sitemap.xml
2016-01-04 12:28:49 -05:00
digitalcraftsman
dfa34afd86
Add template funcs countwords and countrunes
2016-01-02 11:00:03 -05:00
Anthony Fok
cb8f459127
Docs: Add nohighlight shortcode and improve formatting
...
And some random formatting and copyediting fixes.
See also #1708
2015-12-23 09:31:07 -07:00
Maxime Michel
38c5db98b5
Added a missing closing tag
2015-12-11 10:51:17 -07:00
Cameron Moore
9ae07c4f21
Docs: document Node.IsHome
2015-12-11 09:18:05 -07:00
David Oliver
91771ee3b6
Add Draft page variable to docs
...
Also tweaks language used in page params sentence.
2015-11-30 23:38:34 -07:00
Gustav Näslund
b0b6a8c7ac
Use .Site.Pages in the documentation examples instead of .Site.Recent
2015-11-30 23:31:18 -07:00
Cameron Moore
3abb2675c5
Add RSSLink to SiteInfo
2015-11-20 23:38:15 +01:00
Anthony Fok
e59aabcf46
docs: Change "Github" to "GitHub"
2015-11-20 14:24:22 -07:00
digitalcraftsman
a5bd101d27
Docs: fix typo in template function section
2015-11-20 13:30:27 -07: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
digitalcraftsman
341dcc4765
Docs: fix broken links
2015-11-06 08:51:40 -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
Arun Sori
277d0ae4a5
Fix spell mistake in variables.md
2015-10-31 09:47:07 -06:00
Tobias
4e9a5d8bd1
Fix some typos in docs
2015-10-17 13:48:10 +02:00
Bjørn Erik Pedersen
65beca13b0
Add Param to the docs
...
See #1462
2015-10-12 06:11:01 +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
Bjørn Erik Pedersen
2c045ac449
Remove RuneCount from doc
2015-10-06 18:48:42 +02:00
digitalcraftsman
79f8bb625d
Add base64Decode and base64Encode template functions
...
Fixes #1416
2015-09-25 21:31:55 +02:00
Bjørn Erik Pedersen
82f770a6f5
Remove superfluous g
in docs
2015-09-23 09:18:20 +02:00
Bjørn Erik Pedersen
06caa025a4
Fix typo in docs
...
See #1438
2015-09-22 22:33:41 +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
Ben Turner
c2a7c456cc
Fix typo in terms.md
2015-09-15 21:23:44 -06:00
Benny Wu
d313bc78a4
Documentation update on Template Where Function for nil
2015-08-13 23:05:10 +02:00
Michael Diamond
209166a261
Added sitemap configuration documentation.
2015-08-08 15:04:52 -06:00
Michael Diamond
caaf637068
Added mention of .Data.Pages, removed duplicate .Site.Pages mention.
2015-08-08 14:54:46 -06:00
Anthony Fok
ee7dd2929f
docs: More detailed explanation of .Site.LastChange
2015-08-07 23:30:11 -06:00