Commit graph

7475 commits

Author SHA1 Message Date
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
de7dd70bbc Fix some Go code doc issues 2015-08-06 22:58:10 +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
Anthony Fok
5b19a26556 docs: Extend documentation on Blackfriday options
Especially to spell out how the `latexDashes` flag
changes the behavior of smart dashes
2015-08-05 16:24:03 -06:00
Bjørn Erik Pedersen
0b7229f7b2 Add some float tests to TestArethmic 2015-08-05 18:55:25 +02:00
Anthony Fok
4a2eda49cd Add option to disable Blackfriday Smartypants
Can be used in site config or per page front matter:

```
[blackfriday]
smartypants = false
```
2015-08-04 21:42:32 +02:00
Anthony Fok
eb519afefd docs: Fix typos 2015-08-04 13:01:25 -06:00
Anthony Fok
ab8e189a2a docs: Bolden the blackfriday flags to make them stand out
And other minor HTML/CSS tweaks.
2015-08-04 12:34:47 -06:00
Anthony Fok
5505ac0d72 doc: Strip trailing whitespace; other revisions
Make some random and non-comprehensive changes to the
template functions documentation to make them more
consistent.
2015-08-04 12:00:08 -06:00
Anthony Fok
b0416e9bef Strip trailing whitespace in code 2015-08-04 11:59:32 -06:00
Anthony Fok
f2ab0b2608 Improve formatting of Hugo command descriptions
Trying to make them look good both in the terminal (`hugo help [command]`)
and in the web browser (http://gohugo.io/commands/).  :-)
2015-08-04 03:19:57 -06:00
Anthony Fok
e64e571b67 Bump hugo new theme template min_version to 0.14 2015-08-04 02:59:57 -06:00
Tatsushi Demachi
98659bf3b8 Fix searching YAML/TOML delimiters in frontmatter
When a YAML/TOML's delimiter character sequence is included in a
frontmatter string, parser mistakes it as a delimiter. This fixes it by
checking a character right before the delimiter sequence is '\n' or it
is the beginning of the frontmatter.

Fix #1320
2015-08-03 18:30:55 +02:00
Marek Janda
4bed69629e Add map support to scratch 2015-08-02 17:23:36 +02:00
Jeff Hodges
8d28686edc Trim trailing spaces from YAML and TOML delimiters
When someone hits space after typing "---" (or "+++") but before they
hit return, hugo silently failed to parse the file. This corrects that.
2015-08-02 14:46:46 +02:00
Anthony Fok
211b757fee [Docs] Add <br> to an extra-long title in the Press page 2015-08-01 11:38:58 -06:00
Bjørn Erik Pedersen
738f9561ab docs: add netlify article to press section 2015-07-31 13:43:45 +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
Baptiste Mathus
b23b546a30 Asciidoc[tor]: use --no-header-footer option
This simplifies the retrieval of the HTML (no more need to extract the
part within body) and also removes the unwanted "Last Updated" part in
the article.
2015-07-29 17:36:19 +02:00
Bjørn Erik Pedersen
43891e3994 Always use the template provided in page.Render
Fixes #1306
2015-07-29 01:19:29 +02:00
Bjørn Erik Pedersen
3037d200cb Fix inconsistent front matter handling
Fixes #768
2015-07-26 15:28:56 +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
72ecd0cdc7 Ignore non-presence of "layouts" directory in watch logic
Fixes #691
2015-07-25 21:50:24 +02:00
Ryan Clarke
18d69d7f8c Fix periods in taxonomies create bad paths
Fixes #1188
2015-07-25 21:43:20 +02:00
Bjørn Erik Pedersen
c1a2b7a102 Replace strings.Compare
Which is a Go 1.5 func.

See #1299
2015-07-25 17:38:13 +02:00
Bjørn Erik Pedersen
40efc8677a Fix sort test and title sort
See #1299
2015-07-25 17:22:46 +02:00
Bjørn Erik Pedersen
36e0d005ed Fall back to link title for default page sort
Fixes #1299
2015-07-25 16:34:35 +02:00
Sam Debruyn
6674189bc2 The guide is updated to fit the current Wercker interface and configurations.
Wercker changed its interface and default infrastructure (Docker).
2015-07-24 14:35:39 +02:00
Bjørn Erik Pedersen
da0715a0c5 Remove point 7 in contributors guide
It makes sense on its own, but it contradicts 6). We need to revisit this one to make it more clear/better.
2015-07-24 11:41:45 +02:00
Scott C Wilson
d25cd03994 Make small fixes to README file
- Add a step to Contributor instructions for those modifying commands
- Change forum link to http (https does not work)
- Add "Sign the forum release thread" to contributor instructions
2015-07-24 11:35:20 +02:00
Bjørn Erik Pedersen
027abcfbb9 docs: fix prev in highlightling 2015-07-24 11:31:26 +02:00
Szymon Katra
9c8ce0d935 Added szymonkatra.github.io site to showcase 2015-07-24 11:26:24 +02:00
Scott C Wilson
cdefb5a027 Fix links to Ace and Amber pages 2015-07-24 11:22:05 +02:00
Scott C Wilson
de38524cd1 Add scottcwilson.github.io to showcase site 2015-07-24 11:21:56 +02:00
Bjørn Erik Pedersen
28020f866b Move apply before cache put
It just looks better.

See #1293
2015-07-24 00:28:21 +02:00
Bjørn Erik Pedersen
47e65c4acd docs: Rename dynamic content to data-driven content
Fixes #925
2015-07-23 12:54:58 +02:00
Bjørn Erik Pedersen
a9c5133a77 Fix data races in sorting and Reverse
The custom sort functions used from the templates had some subtle data race- and related issues,
especially when used in the single page template.

This commit fixes this by making copies and protect the read and writes with a RWMutex.

The results are cached (it will typically be invoked *number of pages* times with exactly the same data).

This is, not surprisingly, also faster:

```
benchmark                           old ns/op     new ns/op     delta
BenchmarkSortByWeightAndReverse     14228         491           -96.55%

benchmark                           old allocs     new allocs     delta
BenchmarkSortByWeightAndReverse     1              0              -100.00%

benchmark                           old bytes     new bytes     delta
BenchmarkSortByWeightAndReverse     32            0             -100.00%
```

Fixes #1293
2015-07-23 12:43:57 +02:00
Bjørn Erik Pedersen
ea6ae769dc Fix broken test 2015-07-21 21:12:03 +02:00
Bjørn Erik Pedersen
5cf0aa2fc0 Add benchmark for sort and reverse 2015-07-21 21:08:20 +02:00
Bjørn Erik Pedersen
aca0f60448 source/File: Fix data races 2015-07-21 20:02:42 +02:00
Scott C Wilson
dec9749bbc Document Amber templates
Fixes #1064
2015-07-20 15:28:20 +02:00
Scott C Wilson
8a48412c44 On error, return error message, not nil 2015-07-20 14:49:21 +02:00
Scott C Wilson
c00a1fcb7f Add a check for the setting of watch flag in config file
Fixes #1074
2015-07-20 14:20:07 +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
Christopher Eliot
7f1bcd89b2 Fix link to front matter
added leading backslash, changing [front matter](content/front-matter) to [front matter](/content/front-matter)
2015-07-19 19:41:20 +02:00
Clam-
85f4935dec Fix unclear RSS template docs
The documentation for the RSS templating is a little unclear.
http://gohugo.io/templates/rss/

Some users may attempt to look for a ```__internal``` directory rather than assume that's the aforementioned "Hugo own template."

Here's my suggestion.
2015-07-19 19:40:34 +02:00