Commit graph

169 commits

Author SHA1 Message Date
digitalcraftsman 20358f46c8 docs: Document UniqueID page variable 2016-05-27 20:14:52 +02:00
Roy Reveltas 5611631539 docs: Add an example of how to use .PrevInSection
It's not a common knowledge what the "pointer" is so let's
add an example of how to use .PrevInSection
2016-05-27 20:02:29 +02:00
digitalcraftsman ac938d9da7 docs: Improve description for .Hugo.Generator 2016-05-11 20:59:31 +02:00
Alex Leventer a07889d4a3 docs: Fix typo in templates/content.md 2016-05-04 21:40:22 +02:00
mattjmcnaughton bf4206a02f docs: Fix links in the documentation
A couple of internal links use `#toc_4` to attempt to locate a document
element within another document page. In both of these instances, there
is no element on the linked to pages with the id `#toc_4`. This commit
updates those links with the document elements which were the original
intended links, meaning these links now take you directly to the
intended element.

Signed-off-by: mattjmcnaughton <mattjmcnaughton@gmail.com>
2016-05-04 21:35:24 +02:00
Christopher Mancini 09038865c2 tpl: Add intersect operator to where function
Returns true if a given field value that is a slice / array of strings, integers or floats contains elements in common with the matching value. It follows the same rules as the intersect function.

Closes #1945
2016-04-28 00:58:47 +02:00
Bjørn Erik Pedersen eb627ca16d docs: Order by Lastmod 2016-04-22 20:46:04 +02:00
Cameron Moore 76738347d3 docs: Fix findRE typo 2016-04-21 12:38:40 -05:00
Ernie Hershey 215b8939bd docs: Fix grammar in templates/partials.md
Noticed this sentence seemingly missing a word or two.
2016-04-15 18:57:30 +02:00
Bjørn Erik Pedersen 2468b10eb3 docs: Fix example for Param method
Fixes #2070
2016-04-11 13:26:33 +02:00
Erik Ebsen 65f9427031 docs: Document Go 1.6's new ability to trim whitespace 2016-04-09 13:21:23 +02:00
digitalcraftsman 5bfe16ef8d tpl: Add findRE template func 2016-04-05 22:26:03 +02:00
digitalcraftsman 4502c4e3ae docs: Add documentation for hasPrefix template func
Fixes #2039
2016-04-03 00:44:43 +02:00
Bjørn Erik Pedersen c2277fcbc1 docs: Add doc and a test for readDir
Fixes #2009
2016-03-31 23:16:42 +02:00
Bjørn Erik Pedersen 4f66f790b1 Add readFile template func
This also includes a refactor of the hugofs package and its usage.

The motivation for that is:

The Afero filesystems are brilliant. Hugo's way of adding a dozen of global variables for the different filesystems was a mistake. In readFile (and also in some other places in Hugo today) we need a way to restrict the access inside the working dir. We could use ioutil.ReadFile and implement the path checking, checking the base path and the dots ("..") etc. But it is obviously better to use an Afero BasePathFs combined witha ReadOnlyFs. We could create a use-once-filesystem and handle the initialization ourselves, but since this is also useful to others and the initialization depends on some other global state (which would mean to create a new file system on every invocation), we might as well do it properly and encapsulate the predefined set of filesystems. This change also leads the way, if needed, to encapsulate the file systems in a struct, making it possible to have several file system sets in action at once (parallel multilanguage site building? With Moore's law and all...)

Fixes #1551
2016-03-31 21:24:18 +02:00
digitalcraftsman 93e41a1fb2 docs: Fix typo in templates/functions.md 2016-03-28 17:04:29 +02:00
Robert Basic e35a69216e docs: Document lastmod variable
Fixes #1351
2016-03-28 16:33:50 +02:00
Robert Basic 50506ebeac docs: Document the split function
Fixes #1997
2016-03-28 15:58:41 +02:00
Bjørn Erik Pedersen e5e1bcc271 Add plainify template function
To strip away any HTML. May be useful for the .Title in head etc.

People may shoot themself in the foot with this, maybe ...

The replacement function is pretty fast.
2016-03-21 20:27:25 -04:00
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