Commit graph

536 commits

Author SHA1 Message Date
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
bep
beda46d289 Reset Viper for every duplicate menu test iteration 2015-06-11 21:22:29 +02:00
bep
be44345272 Silence chatty JSON test 2015-06-06 20:57:13 +02:00
bep
be38acdce7 Add PreserveTaxonomyNames flag
Before this commit, taxonomy names were hyphenated, lower-cased and normalized -- then fixed and titleized on the archive page.

So what you entered in the front matter isn't necessarily what you got in the final site.

To preserve backwards compability, `PreserveTaxonomyNames` is default `false`.

Setting it to `true` will preserve what you type (the first characters is made toupper for titles), but normalized in URLs.

This also means that, if you manually construct URLs to the archive pages, you will have to pass the Taxonomy names through the `urlize` func.

Fixes #1180
2015-05-31 20:30:53 +02:00
bep
be0903c71a Fix FullFilePath
Fixes #732
2015-05-31 18:54:20 +02:00
Artem Vorotnikov
3cee9b7786 Allow custom RSS Uri for section and taxonomy feeds
Fixes #1147
2015-05-31 15:59:51 +02:00
bep
be7404e337 Support Fish and Chips section
Section names are also used as the title of the list pages, but naming section folders as `Fish and Chips` and similar didn't work very well.

This commit fixes that.

This commit also changes the title casing of the section titles. Some may argue that this is a breaking change, but the old behaviour was also pretty broken,
even for languages that use title capitalizations, as it didn't follow any particular style guide, `fish and chips` became `Fish And Chips` etc.

Now it just turns the first letter into upper case, so `Fish and Chips` will be left as `Fish and Chips`.

People wanting the good old behaviour can use the `title` template func.

Fixes #1176
2015-05-28 23:05:17 +02:00
bep
be535832f7 Add IsHome
To determine if a page is the "Home Page" has inspired lots of creativity in the template department.

This commit makes it simpler: IsHome will tell the truth.
2015-05-28 03:20:08 +02:00
bep
be6dfcc495 Add some missing page permalink test cases 2015-05-28 02:30:01 +02:00
bep
be964e95a1 Never remove trailing slash in RelPermalink
Fixed #1174
2015-05-27 20:41:43 +02:00
bep
bec697b0d5 Remove unused Completed chan on Site
See #1160
2015-05-23 22:13:07 +02:00
bep
be7c3bbb09 Prevent cyclic ref crash in JSON encode
Note that this commit makes no promise about great JSON output from the encoder, but the cyclic refs should be broken.

Fixes #1123
2015-05-23 12:28:08 +02:00
bep
be0784bbe9 Grammar fix in error message 2015-05-21 23:04:46 +02:00
bep
be7f5a4268 Do not consider single.html for the home page
Fixes #1152
2015-05-21 20:12:18 +02:00
spf13
fc946ded29 Adding default handler & tests Fixes #147 2015-05-20 18:55:24 -04:00
spf13
bdb187e482 Merge branch 'master' of GitHub.com:spf13/hugo 2015-05-20 18:48:33 -04:00
spf13
a584ff207b Stop Viper from leaking across many of the tests (now tests pass regardless of order tested) 2015-05-20 02:21:21 -04:00
bep
be0262786e Add benchmark test for replaceShortcodeTokens 2015-05-19 22:00:48 +02:00
Takuya Wakisaka
2890b6db36 Fix UTF8 permalink
Generate unencoded directory in public dir.

Fixes #988
2015-05-17 14:54:59 +02:00
Takuya Wakisaka
8a96234b1f Add Page tests with UTF8 paths
See #988
2015-05-17 14:54:27 +02:00
bep
beaa8b1bca Add support for URLs relative to context root
Setting `RelativeURLs` to `true` will make all relative URLs in the site *really* relative.

And will do so with speed.

So:

In `/post/myblogpost.html`:

`/mycss.css` becomes `../mycss.css`

The same in `/index.html` will become:

`./mycss.css` etc.

Note that absolute URLs will not be touched (either external resources, or URLs constructed with `BaseURL`).

The speediness is about the same as before:

```
benchmark                    old ns/op     new ns/op     delta
BenchmarkAbsURL              17462         18164         +4.02%
BenchmarkAbsURLSrcset        18842         19632         +4.19%
BenchmarkXMLAbsURLSrcset     18643         19313         +3.59%
BenchmarkXMLAbsURL           9283          9656          +4.02%

benchmark                    old allocs     new allocs     delta
BenchmarkAbsURL              24             28             +16.67%
BenchmarkAbsURLSrcset        29             32             +10.34%
BenchmarkXMLAbsURLSrcset     27             30             +11.11%
BenchmarkXMLAbsURL           12             14             +16.67%

benchmark                    old bytes     new bytes     delta
BenchmarkAbsURL              3154          3404          +7.93%
BenchmarkAbsURLSrcset        2376          2573          +8.29%
BenchmarkXMLAbsURLSrcset     2569          2763          +7.55%
BenchmarkXMLAbsURL           1888          1998          +5.83%

```

Fixes #1104
Fixes #622
Fixes #937
Fixes #157
2015-05-16 00:11:44 +02:00
Juan B. Rodriguez
d0a4645a34 Set s.Info.LastChange to Lastmod
Set sitemap.xml <lastmod> field to Lastmod.

See #733
2015-05-15 13:10:11 +02:00