Commit graph

1119 commits

Author SHA1 Message Date
Dan Hersam 2d8e15a565 Version uses binary name instead of hugo
On Windows the binary name is hugo.exe and running hugo version results in
this error:
    GetFileAttributesEx D:\Dev\Go\gopath\bin\hugo: The system cannot find the file specified.

This fixes that error and allows the binary name to be something other
than hugo on any OS.
2015-01-28 09:43:12 +01:00
Dan Hersam 06b1a88358 Added three videos to documentation.
Created shortcode for YouTube videos and made the videos responsive in the
stylesheet.
2015-01-27 23:44:46 +01:00
bep e52a76f559 Use runtime.GOOS to identify Windows specific path tests 2015-01-27 23:01:32 +01:00
bep 0b5f8c8cb3 [doc] Improve paginator doc 2015-01-27 21:56:45 +01:00
bep 7c74a77db6 Replace assert.Equal(true/false) with assert.True/False 2015-01-27 19:47:22 +01:00
bep 251f5e9d40 Do not panic on permission denied
Replace panic with FATAL logging and graceful shutdown.

Fixes #837
2015-01-27 16:51:24 +01:00
bep 8ad4fd05d8 Split Windows and Unix specific path tests 2015-01-27 15:09:01 +01:00
bep b155e8b4cb Temporarily comment out breaking Windows test case 2015-01-27 12:12:35 +01:00
bep bedc2d8488 Introduce FilepathPathBridge
This commit introduces the new interface FilepathPathBridge to remove some code that differs only in their use of either the path or filepath package.
2015-01-27 11:44:41 +01:00
bep 5f9596e68c Add more tests to helper 2015-01-27 10:15:57 +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 0c2297075a Linkify release notes 2015-01-26 20:42:08 +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 a6d22bcf7d Add documentation for pagination
See #750
2015-01-26 14:56:26 +01:00
bep c0fbe61484 Add Bootstrap-compatible pagination.html
See #750
2015-01-26 13:34:12 +01:00
bep 3628d0bbc6 Add pagination to release notes 2015-01-26 13:06:32 +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
Naoya Inada 407e80a9ab Add site-wide/per-page [blackfriday] extensions option 2015-01-26 09:55:37 +01:00
Wade Wegner 39b2cdece0 Wrong URL for Github Pages 2015-01-25 23:00:16 -07:00
Jonathan Anderson e72ce89aaf Move s.prepUrl() before prepending BaseUrl.
When we have an absolute menu url specified in the config file
(e.g., `menu: { main: { name: "News", url: "/news" } }`),
its menu entry is generated by prefixing it with the BaseUrl.
The result is then run through prepUrl(), which uses helpers.Urlize to
convert urls such as 'My First Link' to 'my-first-link'.

The behaviour is backwards: we do not want to run helpers.Urlize on the
BaseUrl, only on the absolute component. Currently, a BaseUrl such as
'http://my.edu/ENG101' will be converted to 'http://my.edu/eng101',
resulting in broken links in all of my menus.

This commit switches the URL prep and BaseUrl prepending actions around. I
would argue that these URLs shouldn't be run through prepUrl anyway
because the site developer has specified them explicitly in a config file
and might be surprised for, e.g., URLs to change case, but that's another
commit for another time.
2015-01-26 01:03:18 +01:00
Kartik Singhal ea72f15f38 Correct wercker URL 2015-01-25 09:44:28 -07:00
Naoya Inada 57b4f3310b Fix inverse notation 2015-01-25 00:13:10 -07:00
Anthony Fok f6c0b472e9 Make Blackfriday smart fractions to really default to true
Fix my own bug in Pull Request #829,
commit eb686352b1
2015-01-24 22:06:15 +01:00
Anthony Fok eb686352b1 Add site-wide/per-page [blackfriday] fractions option
Make Blackfriday's `HTML_SMARTYPANTS_FRACTIONS` option
user-configurable.  Defaults to `true` as before.  See
discussions at:

http://discuss.gohugo.io/t/any-way-to-disable-smart-fractions/328

Thanks to @bjornerik and @spf13 for laying the groundwork
making it easy to expose Blackfriday's underlying configurable
options.
2015-01-24 20:57:40 +01:00
Anthony Fok 803865f870 Fix for page.GetParam() for JSON and TOML maps
Setting per-page Blackfriday angledQuotes did not work
with TOML or JSON front matter, but it does work with YAML.

It turns out that page.Params("blackfriday") returns
type map[interface{}]interface{} for YAML, but
type map[string]interface{} for JSON and TOML.

This patch updates page.GetParam() to catch the latter,
with an error message if page.GetParam() does not recognize
a type.  A test is also added.
2015-01-24 15:25:44 +01:00
Anthony Fok a0c6dba305 Upgrade from gopkg.in/yaml.v1 to gopkg.in/yaml.v2 2015-01-24 04:30:00 -07:00
Jonathan Anderson bd1b019f85 Handle empty front matter in archetype.
If an archetype has deliberately empty front matter (e.g., to suppress
generation of the 'draft' field or to force a particular front matter type
instead of the default TOML), we should handle it gracefully rather than
panic ("assignment to entry in nil map").
2015-01-24 10:46:52 +01:00
Anthony Fok b345ca26cb [Docs]: Add new press/blog coverage about Hugo 2015-01-23 11:46:39 -07:00
bep 1b42dc572a Fix RelPermalink() and Urls in menus vs canonifyUrls
canonifyUrls=true, RelPermalink and baseUrl with sub-path did not work.

This fixes that by adding a check for canonifyUrl=trues=true in RelPermalink().

So given

- baseUrl "http://somehost.com/sub/"
- the path "some-path/file.html"

For canonifyUrls=false RelPermalink() returns "/sub/some-path/file.html"
For canonifyUrls=true RelPermalink() returns "/some-path/file.html"

In the last case, the Url will be made absolute and clickable in a later step.

This commit also makes the menu urls defined in site config releative. To make them work with canonifying of urls, the context root is prepended if canonifying is turned off.

Fixes #519
Fixes #711
2015-01-23 14:13:00 +01:00
Anthony Fok 743998306a [Docs] Document the new (temp?) default of canonifyurls = false
Also add a **Caveat** on http://gohugo.io/tutorials/github-pages-blog/
warning the reader that a `canonifyurls = true` must be added
for Spencer's old example files to work.

Fixes #802
2015-01-22 18:04:07 -07:00
Anthony Fok 60c6faa317 Revert "Try to fix mysterious test failures on Travis"
This reverts commit 71fe85df9b.

See https://github.com/PuerkitoBio/purell/pull/5
for the cause of the mysterious `go test -v ./...` failure.
2015-01-22 17:46:47 -07:00
bep 71fe85df9b Try to fix mysterious test failures on Travis 2015-01-23 00:36:47 +01:00
bep 01ec44a6b4 Add menu tests for pages with both Yaml and Toml front matter
See #817
2015-01-22 17:23:01 +01:00
bep 020c0b863f Revert "Quick-and-dirty way to print details of template errors"
This reverts commit 42b33102cf.
2015-01-22 11:14:04 +01:00
bep 6db6d33bec Add dateFormat to release notes 2015-01-22 01:19:02 +01:00
Tatsushi Demachi 37490ee27a Add dateFormat template function
This is the implementation of the proposal at #235 and
http://discuss.gohugo.io/t/parsing-dates-in-templates/603/3
2015-01-22 00:08:30 +01:00
bep 878754c21f Protect the innerShortCodeCache by a RW lock 2015-01-21 19:13:11 +01:00
bep c8f8f48e96 Cache the page's rendering context flags
This map can potentially be used many times for a given page, and altough the cost of re-creating the map should be minimal, caching it is simple -- and could save some GC and CPU cycles.
2015-01-21 15:30:03 +01:00
Anthony Fok 19c52ab0b5 Register rstHandler to restore experimental reST support
(Experimental) reStructuredText support was working in v0.12,
but was no longer handled after some refactoring in v0.13-DEV.
That experimental support is now restored.

Furthermore, check for both rst2html and rst2html.py in the PATH,
and execute whichever is found.

See #472 for more information.
2015-01-21 06:41:19 -07:00
bep 1cc6386937 Make ref and relref respect plainIdAnchors
Fixes #813
2015-01-21 14:35:33 +01:00
Peter Krautzberger e5be592ee0 fix outdated MathJax CDN URL
The rackspace address has been retired, see http://www.mathjax.org/changes-to-the-mathjax-cdn/
2015-01-21 03:16:04 -07:00
Anthony Fok 173aa53b8a [Docs] Use of $. to access global context from anywhere
See #804, http://discuss.gohugo.io/t/templates-multiple-parameters/600/3
and http://stackoverflow.com/questions/16734503/access-out-of-loop-value-inside-golang-templates-loop
for related discussions.
2015-01-21 00:35:12 -07:00
Anthony Fok f015e9b8e0 [Docs] Recommend the use of backticks for IE conditionals
Special thanks to @tatsushid and @bjornerik for the insight!

Fixes #778.
2015-01-20 23:45:26 -07:00
Anthony Fok 02da49597d Fix string comparison for .Truncated page variable
Instead of `strings.TrimSpace()`, use `strings.Join(strings.Fields(s), " ")`
to collapse all whitespaces into single spaces, in order to match the
behaviour of helpers.TruncateWordsToWholeSentence(),
in order to detect non-truncated content correctly.
2015-01-20 15:50:32 -07:00
Anthony Fok a17c290a33 [Docs] Correct description of "Read More" links in Summaries
Also revise some paragraphs for succinctness.

Fixes #788
2015-01-20 15:45:57 -07:00
Anthony Fok edcdb6f49c Fix two errors in two internal templates
* template: _internal/_default/opengraph.html:39: unexpected EOF
 * template: _internal/_default/schema.html:15: unexpected {{end}}

Also change the DateTime inside these templates to ISO 8601 format,
and skip <meta itemprop="datePublished"> if `publishdate` is not set.

Perhaps it would be a good idea to expose `func (Time) IsZero`
to our templates?  :-)
2015-01-20 15:39:43 -07:00
bep d897b1e8a7 Add missing assertion to trim-test 2015-01-20 22:31:05 +01:00
Nikolay Kirsh 932214d725 fix --uglyUrls params 2015-01-20 13:51:15 -07:00
bep 2ec046afb1 Minor polish in path/url 2015-01-20 20:45:03 +01:00
bep 9e688507a7 Add more tests to general helper 2015-01-20 18:13:47 +01:00