Commit graph

557 commits

Author SHA1 Message Date
coderzh 0e1fd78fb2 WordCount Summary support UTF-8 string 2015-09-12 15:41:17 +02:00
chrongzhang 52d94fa675 Add config option "disablePathToLower"
Enabling this prevents lowercasing of the path/url.

Fixes #557
2015-09-01 15:26:02 +02:00
Jeff Hodges 49fe04c0bd Correct check of published boolean 2015-08-31 05:26:46 +02:00
Jeff Hodges 311593bff0 Add undocumented published setting to front matter
A new "published" setting that is the opposite of "draft" is added and
left intentionally undocumented.

This setting comes from jekyll and eases the transition to hugo
greatly. We leave it undocumented so that folks don't rely on it, but
also don't shoot themselves in the foot during a jekyll migration.

The foot-shooting occurs if they have only a few documents that were
drafts ("published: false") in the jekyll version of their site and
don't notice that they were published in the migration to hugo.
2015-08-30 20:40:56 +02:00
Bjørn Erik Pedersen 04b4c996ac Reset Scratch for 404
The 404 pages etc. need a better solution, but fix this issue for now.

Fixes #1336
2015-08-07 20:30:01 +02:00
Bjørn Erik Pedersen 0f1fb8c7d8 Avoid panic in shortcode param handling
Fixes #1337
2015-08-07 20:08:23 +02:00
Bjørn Erik Pedersen 35bb72c83e Do not panic on index out of range in shortcode.Get
Fixes #1335
2015-08-07 19:21:26 +02:00
Anthony Fok b0416e9bef Strip trailing whitespace in code 2015-08-04 11:59:32 -06:00
Marek Janda 4bed69629e Add map support to scratch 2015-08-02 17:23:36 +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
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
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
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 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
Edward Vielmetti c8477c4f6e Fix typo: "taxononomy" -> "taxonomy" 2015-07-19 19:36:23 +02:00
Bjørn Erik Pedersen 1a94148d06 Add paginator support for page groups
Fixed #1274
2015-07-18 14:53:52 +02:00
Valere JEANTET 2c22a8b79a fix TestHomeNodeMenu test
Signed-off-by: Valere JEANTET <valere.jeantet@gmail.com>
2015-07-14 21:31:47 +02:00
Valere JEANTET 247574976c Allow page.HasMenuCurrent() and node.HasMenuCurrent() to proceed with multi-level nested menus
Currently HasMenuCurrent only process the first 2 levels.
2015-07-14 21:31:47 +02:00
Bjørn Erik Pedersen a2fa3895ee Fix log message in test 2015-07-12 19:27:29 +02:00
Bjørn Erik Pedersen 3663828f5e Optimize RuneCount
Do not create it unless used.

See #1266
2015-07-12 11:28:19 +02:00
Bjørn Erik Pedersen 77c60a3440 Add RuneCount to Page
Fixes #1266
2015-07-12 11:05:37 +02:00
delputnam 9b3d0cf5bf Added missing "Social" section to SiteInfo
I could be wrong here, but it looks to me like .Site.Social.facebook is used in tpl/template_embedded.go, but the variable is never set. I've added a line to initializeSiteInfo to map the info from config into this variable.
2015-07-02 19:26:01 +02:00
Marc-Antoine Ruel c9fc0e786f Add Page.RawContent() to access raw Markdown as a string.
In particular, RawContent() excludes the metadata header.

This is necessary in the use case of embedding remarkjs.com slides, as it needs
the unprocessed Markdown content to generate the slides.
2015-07-02 19:24:30 +02:00
Bjørn Erik Pedersen 664a97819f 404 is homeless
Fixes #1235
2015-06-28 10:43:43 +02:00
Piotr Kowalczuk 29e786aac5 Proper parsing structured array from yaml based FrontMatter 2015-06-25 17:56:22 +02:00
Bjørn Erik Pedersen e764a6e638 Use pooled buffer in replaceShortcodes
Even as a copy at the end is needed, this consumes way less memory on Go 1.4.2:

```benchmark                           old ns/op     new ns/op     delta
BenchmarkParsePage                  145979        139964        -4.12%
BenchmarkReplaceShortcodeTokens     633574        631946        -0.26%
BenchmarkShortcodeLexer             195842        187938        -4.04%

benchmark                           old allocs     new allocs     delta
BenchmarkParsePage                  87             87             +0.00%
BenchmarkReplaceShortcodeTokens     9424           9415           -0.10%
BenchmarkShortcodeLexer             274            274            +0.00%

benchmark                           old bytes     new bytes     delta
BenchmarkParsePage                  141830        141830        +0.00%
BenchmarkReplaceShortcodeTokens     35219         25385         -27.92%
BenchmarkShortcodeLexer             30178         30177         -0.00%
```
See #1148
2015-06-22 20:30:20 +02:00
Bjørn Erik Pedersen d4b6f9aca3 Fix map-order dependent menu tests
Fixes #1222
2015-06-21 23:36:58 +02:00
Bjørn Erik Pedersen c507229191 Print URL when failing menu test
See #1222
2015-06-21 23:09:39 +02:00
Bjørn Erik Pedersen dbd93f5112 Remove unused var 2015-06-21 22:57:42 +02:00
Bjørn Erik Pedersen 004fcddc80 Remove superfluous p-tags around shortcodes
This commit replaces the regexp driven `replaceShortcodeTokens` with a handwritten one.

It wasnt't possible to handle the p-tags case without breaking performance.

This fix actually improves in that area:

```
benchmark                           old ns/op     new ns/op     delta
BenchmarkParsePage                  142738        142667        -0.05%
BenchmarkReplaceShortcodeTokens     665590        575645        -13.51%
BenchmarkShortcodeLexer             176038        181074        +2.86%

benchmark                           old allocs     new allocs     delta
BenchmarkParsePage                  87             87             +0.00%
BenchmarkReplaceShortcodeTokens     9631           9424           -2.15%
BenchmarkShortcodeLexer             274            274            +0.00%

benchmark                           old bytes     new bytes     delta
BenchmarkParsePage                  141830        141830        +0.00%
BenchmarkReplaceShortcodeTokens     52275         35219         -32.63%
BenchmarkShortcodeLexer             30177         30178         +0.00%
```

Fixes #1148
2015-06-21 22:51:12 +02:00
Bjørn Erik Pedersen ae4f72b091 Comment out mystery test
Fails on Travis in Go 1.3 + 1.5.

Will have to look into that one.
2015-06-21 22:28:50 +02:00
Bjørn Erik Pedersen 6bcb7e83e7 Revert "add preliminary support for content/index.md file to be homepage content"
This reverts commit 5f84bc02cd.
2015-06-21 15:01:09 +02:00
Bjørn Erik Pedersen 3eb301b57a Revert "refactor and clean up site tests"
This reverts commit 99e250917d.
2015-06-21 15:01:06 +02:00
Bjørn Erik Pedersen f25ce7fefa Revert "Move matchRender to test helpers file"
This reverts commit 32d91d616e.
2015-06-21 15:01:02 +02:00
Bjørn Erik Pedersen d770fa59a5 Revert "Add tests for homepage content support"
This reverts commit 24351c58be.
2015-06-21 15:01:01 +02:00
Bjørn Erik Pedersen 59c6ba4e45 Revert "Make .IsHome work when homepage as page"
This reverts commit 7e765cc1bd.
2015-06-21 15:00:53 +02:00
spf13 7e765cc1bd Make .IsHome work when homepage as page 2015-06-19 10:07:47 -04:00
spf13 24351c58be Add tests for homepage content support 2015-06-17 12:35:44 -04:00
spf13 32d91d616e Move matchRender to test helpers file 2015-06-17 10:47:49 -04:00
spf13 99e250917d refactor and clean up site tests 2015-06-17 10:47:49 -04:00
spf13 5f84bc02cd add preliminary support for content/index.md file to be homepage content 2015-06-17 10:47:49 -04:00
bep be6cf6a9c6 Revert "Add some debug to failing menu test"
This reverts commit becc627e1e.
2015-06-12 22:49:49 +02:00
bep becc627e1e Add some debug to failing menu test 2015-06-11 22:49:07 +02:00
bep bed8197de5 Move Viper reset to correct level in menu tests 2015-06-11 22:41:17 +02:00