Commit graph

444 commits

Author SHA1 Message Date
bep
91d16fbba0 Fix UglyUrls on Windows
Fixes #958
2015-03-07 18:03:17 +01:00
bep
602ceec06d Handle 404 thread safely
Replaces hack that temporarily changes a global flag.

Fixes #955
Fixes #939
2015-03-07 15:18:00 +01:00
bep
851badcb7e There is only one s.PageTarget() - so we cannot change it, even tempoararily. We have to find another solution to this.
...

Prevent 404.html from prettifying into 404/index.html

Restore @realchaseadams's commit 348e123
"Force `UglyUrls` option to force `404.html` file name"
which got lost after some refactoring (commit 8db3c0b).

Remove the equivalent "force `UglyUrls`" code for `sitemap.xml`
because the refactored code now calls `renderAndWriteXML()`
which uses `WriteDestFile()` which does not prettify a filename.

Fixes #939 (reverted from commit c4c19ad303)
2015-03-07 13:22:02 +01:00
bep
e007c9b25d hugolib: apply some more Golint rules 2015-03-07 12:53:20 +01:00
bep
5759007874 menu: make receiver name on Page methods consistent
Apply some Golint rules on Menu, esp. making the method receiver names consistent.
2015-03-07 12:52:29 +01:00
bep
e24a775962 page: make receiver name on Page methods consistent
Apply some Golint rules on Page, esp. making the method receiver names consistent:

(page *Page) ==> (p *Page)
2015-03-07 12:25:38 +01:00
bep
8539f78143 hugolib: apply some Hugolint rules 2015-03-07 00:13:06 +01:00
bep
b9f8c0c120 author: fix doc 2015-03-07 00:10:00 +01:00
bep
103ea842f8 Fix errors reported by Go Vet 2015-03-06 15:25:19 +01:00
Anthony Fok
c4c19ad303 Prevent 404.html from prettifying into 404/index.html
Restore @realchaseadams's commit 348e123
"Force `UglyUrls` option to force `404.html` file name"
which got lost after some refactoring (commit 8db3c0b).

Remove the equivalent "force `UglyUrls`" code for `sitemap.xml`
because the refactored code now calls `renderAndWriteXML()`
which uses `WriteDestFile()` which does not prettify a filename.

Fixes #939
2015-03-06 13:12:01 +01:00
bep
3343cacc0e Avoid panic when pagination on 0 pages
Fixes #948
2015-03-06 00:48:33 +01:00
bep
6e1b0e0c00 Apply gofmt -s 2015-03-05 23:57:38 +01:00
bep
8557e2cbb8 Add benchmark for the shortcode lexer 2015-03-05 21:11:15 +01:00
bep
ab5862cd00 Allow the same shortcode to be used with or without inline content
Fixes #934
2015-03-02 21:49:33 +01:00
bep
241f9f9e46 Improve error message on missing shortcode inner content
Fixes #933
2015-02-28 19:24:30 +01:00
bep
9d80ecb4d8 Keep trailing slash when baseUrl contains a sub path
Before this commit, .Site.BaseUrl ended up as:

http://mysite.com/ => http://mysite.com/
http://mysite.com/sub/ => http://mysite.com/sub

Now it becomes:

http://mysite.com/ => http://mysite.com/
http://mysite.com/sub/ => http://mysite.com/sub/

Fixed #931
2015-02-28 18:45:02 +01:00
bep
176ce5deab Allow hyphens in shortcode name
Fixes #929
2015-02-27 11:57:23 +01:00
spf13
729a6739f2 Bumping to version "v0.14-DEV" 2015-02-21 23:11:36 -05:00
bep
dc7b7ef865 Avoid race condition in target list init
As reported by Go's race detector.

See #917
2015-02-20 18:38:35 +01:00
bep
c33a8528f8 Avoid race condition in isInnerShortcode
As reported by Go's race detector.

See #917
2015-02-20 17:41:37 +01:00
bep
8ed67169ed Fix broken data dir test 2015-02-11 21:55:11 +01:00
bep
8df59c8123 Temporarily disable broken test 2015-02-11 20:33:19 +01:00
bep
ebcc1e6699 Add data files support in themes
If duplicate keys, the main data dir wins.

Fixes #892
2015-02-11 20:24:56 +01:00
bep
fa71f6c11e Make # survice Url cleaning
To enable anchors in Urls.

Fixes #888
2015-02-10 19:14:19 +01:00
bep
22d85c2a18 Avoid converting summary to []byte and back to string 2015-02-10 14:37:29 +01:00
bep
6afe70d5da Better error message for data-file parsing errors 2015-02-09 16:07:30 +01:00
bep
1c50f775b5 DataDir: Minor polish and add missing tests
Also, now logs an ERROR on duplicate keys, instead of returning an error and make sure sub-folders take presedence in data dir.
2015-02-09 13:19:19 +01:00
Erlend Klakegg Bergheim
773812de6f Reads data files inside data/ and makes data available in .Site.Data
Fixes #476.

Conflicts:
	hugolib/site.go
2015-02-09 13:17:13 +01:00
bep
48b6777ea2 Fix Truncate
TruncateWordsToWholeSentence knows if the summary is truncated, so let "him" decide.

Fixes #880
2015-02-05 14:04:48 -07:00
bep
f8704c1bf2 Avoid calling strings.Fields multiple times with same content
This should be a relief for big sites.
2015-02-05 00:38:50 +01:00
bep
11a19e0760 Build PageMenus only once 2015-02-04 21:27:27 +01:00
bep
8b95cab94c Avoid panic on unknown markup
Fixes #863
2015-02-01 22:30:57 +01:00
bep
b984ec96bc Optimize for the common case in Blackfriday config 2015-01-31 23:45:38 +01:00
Anthony Fok
c50780930e Print template parsing errors to aid troubleshooting
Added a new Template.PrintErrors() function call,
used in hugolib/site.go#Process() so it does not clutter
up `go test -v ./...` results.

Special thanks to @tatsushid for mapping out the call trace
which makes it a lot easier to find the appropriate places
to place the Template.PrintErrors() call.

Fixes #316
2015-01-31 23:27:50 +01:00
Naoya Inada
d1364ffb68 Fix defaults for Blackfriday 2015-01-31 22:06:50 +01:00
bep
420c9e4d3d Add writable context to Node
The variable scope in the Go templates makes it hard, if possible at all, to write templates with counter variables or similar state.

This commit fixes that by adding a writable context to Node, backed by a map: Scratch.

This context has three methods, Get, Set and Add. The Add is tailored for counter variables, but can be used for any built-in numeric values or strings.
2015-01-31 22:01:30 +01:00
bep
47c8f32967 Prevent site config being overwritten
Fixed #867
2015-01-31 19:14:13 +01:00
spf13
f4737689bd Updating shortcode imports & site test to work with new buffer pool functions 2015-01-31 01:24:52 -05:00
spf13
e1e6aaed2f Merge branch 'master' of github.com:spf13/hugo 2015-01-31 01:04:28 -05:00
spf13
8db3c0b0a6 page rendering and writing using BBP 2015-01-30 12:05:05 -08:00
Jeffrey Tolar
35684e8f6f Use strings instead of byte arrays for replaceShortcodeTokens tests 2015-01-30 20:58:25 +01:00
Jeffrey Tolar
366c557251 Use a regular expression in replaceShortcodeTokens
This fixes a bug where a shortcode needs to be expanded multiple times,
which can arise in practice when using reference links.
2015-01-30 20:58:25 +01:00
spf13
b4c507287a site's XML generation using BBP 2015-01-30 11:51:06 -08:00
spf13
77074127e0 page source creation using BBP 2015-01-30 11:42:02 -08:00
spf13
2f2297bdb3 shortcodes using BBP 2015-01-30 11:19:46 -08:00
Anthony Fok
ba44e860a3 [Docs] Copyediting
* Add meta author, description and generator tags
 * Add Hugo version beside the logo and in the footer
 * Suggest the user to run `go get -u -v` to update dependencies
 * Requires Go 1.3+ rather than Go 1.1+
 * Improve rendering/formatting in some places
 * Add trailing slash to URLs where appropriate
 * GitHub redirects all http requests to https, update accordingly
2015-01-28 18:02:40 -07:00
bep
7c74a77db6 Replace assert.Equal(true/false) with assert.True/False 2015-01-27 19:47:22 +01:00
bep
de76d4a84e Improve pagination testing
* Add missing pagination test cases
* Remove some unreachable code paths
* Fix some corner cases
2015-01-27 01:27:07 +01:00
bep
fb594fc6e0 Set detault for Paginate to 10
10 is a better default than 0, since no paginator pages will be created unles referenced by a `.Paginator`.

See #750
2015-01-26 15:26:19 +01:00
bep
37445bc6aa Add pagination support for home page, sections and taxonomies
Two new configuration properties, `Paginate` (default `0`) and `PaginatePath` (default `page`) are added.

Setting `paginate` to a positive value will split the list pages for the home page, sections and taxonomies into chunks of size of the `paginate` property.

A `.Paginator` is provided to help building a pager menu.

There are two ways to configure a `.Paginator`:

1. The simplest way is just to call `.Paginator.Pages` from a template. It will contain the pages for "that page" (`.Data.Pages` will (like today) contain all the pages).
2. Select a sub-set of the pages with the available template functions and pass the slice to `.Paginate` : `{{ range (.Paginate (where .Data.Pages "Type" "post")).Pages }}`

**NOTE:** For a given Node, it's one of the options above. It's perfectly legitimate to iterate over the same pager more than once, but it's static and cannot change.

The `.Paginator` contains enough information to build a full-blown paginator interface.

The pages are built on the form (note: BLANK means no value, i.e. home page):

```
[SECTION/TAXONOMY/BLANK]/index.html
[SECTION/TAXONOMY/BLANK]/page/1/index.html => redirect to  [SECTION/TAXONOMY/BLANK]/index.html
[SECTION/TAXONOMY/BLANK]/page/2/index.html
....
```

Fixes #96
2015-01-26 12:59:37 +01:00