Commit graph

3203 commits

Author SHA1 Message Date
Bjørn Erik Pedersen
3c405f5172 all: Document the Output Formats feature
This commit also adds a new command, docshelper, with some utility funcs that adds a JSON datafiles to /docs/data that would be a pain to create and maintain by hand.

Fixes #3242
2017-04-07 10:52:16 +02:00
Bjørn Erik Pedersen
9580872459 hugolib: Update deprecation vs Hugo 0.20
Fixes #3271
2017-04-07 10:48:09 +02:00
Bjørn Erik Pedersen
af99a59021 output: Add some sane defaults for output format
Fixes #3290
2017-04-07 10:43:48 +02:00
Albert Nigmatzianov
260b55ea56 tpl: Set RenderingContext.Config in markdownify 2017-04-06 21:02:37 +02:00
Albert Nigmatzianov
8f09e5f6bc helpers: Add new properties to ContentSpec 2017-04-06 21:02:37 +02:00
Bjørn Erik Pedersen
c4a1165587 all: Handle all errors
As reported by `errcheck`.
2017-04-06 20:35:26 +02:00
Bjørn Erik Pedersen
e77bb13c20 media, output: Fix spelling 2017-04-06 15:28:56 +02:00
Bjørn Erik Pedersen
e6e1aca3f4 docs: Disable GitInfo by default
Use `--enableGitInfo` when publishing.

This gives a much better out-of-the-box editing experience.
2017-04-06 13:50:10 +02:00
Chris Hager
f3b4a0e99e docs: Add info about Pygments installation in installing.md
Additional information about the Pygments dependency in the "installing from source" chapter.
2017-04-06 13:48:22 +02:00
Li-Wen Yip
0dd6890ed5 docs: Add article by Li-Wen Yip to press section 2017-04-06 13:38:32 +02:00
Bjørn Erik Pedersen
6650fae7ad tpl: Fix nil pointer in Tree()
Fixes #3285
2017-04-05 22:12:03 +02:00
Ricardo N Feliciano
b31da911b5 docs: Properly capitalize GitHub 2017-04-05 18:41:23 +02:00
Bjørn Erik Pedersen
1425587193 hugolib: Add optional outputFormat to Ref/RelRef
Fixes #3224
2017-04-04 23:09:01 +02:00
Bjørn Erik Pedersen
a883948c4f Register all media types when in server mode
Fixes #3274
2017-04-04 18:05:19 +02:00
Bjørn Erik Pedersen
bc36d468ab tplimpl: Reintroduce the double template lookup in Partial
So it works as before without the html suffix.

Fixes #3272
2017-04-04 17:21:04 +02:00
Bjørn Erik Pedersen
7da1b65968 all: Use the configured output types to resolve template type
Closes #320
2017-04-04 15:12:30 +02:00
Bjørn Erik Pedersen
868f89d5c6 hugolib: Improve render error handling
Catch and return the "template not found" error earlier.
2017-04-04 15:12:30 +02:00
Bjørn Erik Pedersen
04d80e6e87 commands, helpers: Add correct verbose log level to the global loggers
We still use those in some cases.
2017-04-04 15:12:30 +02:00
Bjørn Erik Pedersen
0802f79e66 output: Make template name lower cased 2017-04-04 15:12:30 +02:00
Bjørn Erik Pedersen
10ff2f31a6 hugolib: Read media types and output formats from site config
Closes #3222
Closes #3223
2017-04-04 15:12:30 +02:00
Bjørn Erik Pedersen
f8d555cca5 media: Add DecodeTypes
And clean up the media package.
2017-04-04 15:12:30 +02:00
Bjørn Erik Pedersen
c9aee467d3 output: Add output formats decoder
And clean up the output package.
2017-04-04 15:12:30 +02:00
Bjørn Erik Pedersen
d6e8b86f66 output: Add CSV to the global output formats list 2017-04-04 15:12:30 +02:00
Albert Nigmatzianov
a098081c4a vendor: Update go-i18n 2017-04-03 08:34:12 +02:00
Kamil Samigullin
5d7eeeadf0 docs: Remove localhost part from link
Fixes #3264
2017-04-03 01:29:53 +02:00
Bjørn Erik Pedersen
8b5b558bb5 tpl: Rework to handle both text and HTML templates
Before this commit, Hugo used `html/template` for all Go templates.

While this is a fine choice for HTML and maybe also RSS feeds, it is painful for plain text formats such as CSV, JSON etc.

This commit fixes that by using the `IsPlainText` attribute on the output format to decide what to use.

A couple of notes:

* The above requires a nonambiguous template name to type mapping. I.e. `/layouts/_default/list.json` will only work if there is only one JSON output format, `/layouts/_default/list.mytype.json` will always work.
* Ambiguous types will fall back to HTML.
* Partials inherits the text vs HTML identificator of the container template. This also means that plain text templates can only include plain text partials.
* Shortcode templates are, by definition, currently HTML templates only.

Fixes #3221
2017-04-02 23:13:10 +02:00
Albert Nigmatzianov
27610ddd01 hugolib: Don't ignore errors from applyDepsIfNeeded 2017-04-02 18:43:32 +02:00
Albert Nigmatzianov
6b29bccfee hugolib, i18n: Update tests with flat format and TOML files 2017-04-02 18:43:32 +02:00
Albert Nigmatzianov
28fdd71c29 vendor: Update go-i18n
Fix #2577
2017-04-02 18:43:32 +02:00
Albert Nigmatzianov
fe8462b205 docs, examples: Use TOML for i18n config files
Fix #3200
2017-04-02 18:43:32 +02:00
Chase Adams
d122260de7 vendor: update goorgeous 2017-04-02 18:34:17 +02:00
Enrique Saez
a037b855dd docs: Add blog of Enrique Saez Gil to the site showcase 2017-04-02 18:29:24 +02:00
Bjørn Erik Pedersen
7eb71ee064 Revert "tpl: Rework to handle both text and HTML templates"
Will have to take another stab at this ...

This reverts commit 5c5efa03d2.

Closes #3260
2017-04-02 14:20:34 +02:00
Bjørn Erik Pedersen
c97dae40d9 hugolib: Use Page Kind in template errors to prevent log spam
Having the content page name in the log key for the distinct error logger isnt't very usable when you have an error in a commonly used partial.

Using the Page Kind reduces the amount of log entries. Here is an example from an error in the partial menu.html, used in all the page templates:

```
Started building sites ...
ERROR 2017/04/02 12:19:43 Error while rendering "page": template: /Users/bep/sites/bepsays.com/layouts/_default/single.html:17:7: executing "/Users/bep/sites/bepsays.com/layouts/_default/single.html" at <partial "menu.html" ...>: error calling partial: template: partials/menu.html:9:11: executing "partials/menu.html" at <.DoesNotExist>: can't evaluate field DoesNotExist in type *hugolib.PageOutput
ERROR 2017/04/02 12:19:43 Error while rendering "section": template: /Users/bep/sites/bepsays.com/layouts/_default/section.html:17:7: executing "/Users/bep/sites/bepsays.com/layouts/_default/section.html" at <partial "menu.html" ...>: error calling partial: template: partials/menu.html:9:11: executing "partials/menu.html" at <.DoesNotExist>: can't evaluate field DoesNotExist in type *hugolib.PageOutput
ERROR 2017/04/02 12:19:43 Error while rendering "taxonomy": template: /Users/bep/sites/bepsays.com/layouts/_default/list.html:17:7: executing "/Users/bep/sites/bepsays.com/layouts/_default/list.html" at <partial "menu.html" ...>: error calling partial: template: partials/menu.html:9:11: executing "partials/menu.html" at <.DoesNotExist>: can't evaluate field DoesNotExist in type *hugolib.PageOutput
ERROR 2017/04/02 12:19:43 Error while rendering "home": template: /Users/bep/sites/bepsays.com/layouts/index.html:17:7: executing "/Users/bep/sites/bepsays.com/layouts/index.html" at <partial "menu.html" ...>: error calling partial: template: partials/menu.html:9:11: executing "partials/menu.html" at <.DoesNotExist>: can't evaluate field DoesNotExist in type *hugolib.PageOutput
ERROR 2017/04/02 12:19:43 Error while rendering "404": template: 404.html:2:3: executing "404.html" at <partial "menu.html" ...>: error calling partial: template: partials/menu.html:9:11: executing "partials/menu.html" at <.DoesNotExist>: can't evaluate field DoesNotExist in type *hugolib.PageOutput
Built site for language nn:
```
Which is pretty good.
2017-04-02 12:22:54 +02:00
Bjørn Erik Pedersen
0aeadfd02d tplimpl: Add test with failing partial
Main motivation to see that the containing template name is included in the error message name.

It is.
2017-04-02 12:06:21 +02:00
Bjørn Erik Pedersen
5c5efa03d2 tpl: Rework to handle both text and HTML templates
Before this commit, Hugo used `html/template` for all Go templates.

While this is a fine choice for HTML and maybe also RSS feeds, it is painful for plain text formats such as CSV, JSON etc.

This commit fixes that by using the `IsPlainText` attribute on the output format to decide what to use.

A couple of notes:

* The above requires a nonambiguous template name to type mapping. I.e. `/layouts/_default/list.json` will only work if there is only one JSON output format, `/layouts/_default/list.mytype.json` will always work.
* Ambiguous types will fall back to HTML.
* Partials inherits the text vs HTML identificator of the container template. This also means that plain text templates can only include plain text partials.
* Shortcode templates are, by definition, currently HTML templates only.

Fixes #3221
2017-04-02 11:37:30 +02:00
Albert Nigmatzianov
73c1c7b69d vendor: Update cobra
Really fix #2349
b7a672f didn't actually the issue.
2017-04-01 20:28:18 +02:00
Bjørn Erik Pedersen
f911b107ef media, output: Add CSV type and format
And make CSS correclty behave as plain text.
2017-04-01 15:12:31 +02:00
digitalcraftsman
05949c9038 docs: Fix typo/source link in firstname.club showcase addition 2017-03-31 22:49:09 +02:00
Pedro Gomes
d5036c3ab5 docs: Update link to Disqus alternative Livefyre.com
Livefyre.com is down.

Livefyre was integrated into Adobe's offering.

The product is now called Adobe Experience Manager Livefyre.

Wikipedia points to web.livefyre.com which redirects to the link I provided in the commit.
2017-03-31 22:41:22 +02:00
bit swarm
af1f9ecf91 docs: Add firstname.club to the showcase 2017-03-31 22:38:22 +02:00
Bjørn Erik Pedersen
42a4f6f9cb tplimpl: Fix map data race in URLLock 2017-03-31 10:40:33 +02:00
Bjørn Erik Pedersen
79b34c2f1e tplimpl: Fix deadlock in getJSON
Fixes #3211
2017-03-31 09:17:03 +02:00
Bjørn Erik Pedersen
3c6b16d5a2 vendor: Update fsnotify with several Linux-fixes 2017-03-29 13:30:31 +02:00
Bjørn Erik Pedersen
87b3cd4655 hugolib, helpers: Reduce log level to WARN on .Render for non-regular pages
We will eventually support all types in the Render method.
2017-03-29 08:08:45 +02:00
Bjørn Erik Pedersen
5989c4d464 helpers, output: Fix spelling 2017-03-28 01:19:46 +02:00
Bjørn Erik Pedersen
af55ec7661 hugolib, output: Gofmt 2017-03-28 01:18:15 +02:00
Bjørn Erik Pedersen
f2fbf0b2ea media: Add some more relevant MIME types 2017-03-28 00:09:25 +02:00
Bjørn Erik Pedersen
4923273688 tplimpl: Fix lookup with non-standard layout folder 2017-03-27 15:43:56 +02:00
Bjørn Erik Pedersen
930a3df1b7 hugolib, output: Restrict Render to regular Pages
Using it for list pages doesn't work and has potential weird side-effects.

The user probably meant to range over .Site.ReqularPages, and that is now marked clearly in the log.
2017-03-27 15:43:56 +02:00