summaryrefslogtreecommitdiffstats
path: root/tpl
AgeCommit message (Collapse)Author
2018-11-06tpl/collections: Add collections.ComplementBjørn Erik Pedersen
Fixes #5400
2018-11-03Make WARN the new default log log levelBjørn Erik Pedersen
This commit also pulls down the log level for a set of WARN statements to INFO. There should be no ERRORs or WARNINGs in a regular Hugo build. That is the story about the Boy Who Cried Wolf. Since the WARN log is now more visible, this commit also improves on some of them, most notable the "layout not found", which now would look something like this: ```bash WARN 2018/11/02 09:02:18 Found no layout for "home", language "en", output format "CSS": create a template below /layouts with one of these filenames: index.en.css.css, home.en.css.css, list.en.css.css, index.css.css, home.css.css, list.css.css, index.en.css, home.en.css, list.en.css, index.css, home.css, list.css, _default/index.en.css.css, _default/home.en.css.css, _default/list.en.css.css, _default/index.css.css, _default/home.css.css, _default/list.css.css, _default/index.en.css, _default/home.en.css, _default/list.en.css, _default/index.css, _default/home.css, _default/list.css ``` Fixes #5203
2018-11-02Revert "tpl: Update Jsonify to return pretty-print output"Bjørn Erik Pedersen
This reverts commit 5a52cd5f920bb3d067ab1682adece9f813c67ba1. Closes #5394
2018-11-02tpl: Fix the docshelperBjørn Erik Pedersen
2018-11-01Add file (line/col) info to ref/relref errorsBjørn Erik Pedersen
See #5371
2018-10-30tpl: Fix BOM issue in templatesBjørn Erik Pedersen
Fixes #4895
2018-10-24tpl: Handle truncated identifiers in Go template errorsBjørn Erik Pedersen
Long identifiers will give errors on the format: ```bash _default/single.html:5:14: executing "main" at <.ThisIsAVeryLongTitl...>: can't evaluate field ThisIsAVeryLongTitle ``` Hugo use this value to match the "base template or not", so we need to strip the "...". Fixes #5346
2018-10-24Run gofmt -sBjørn Erik Pedersen
2018-10-23Resolve error handling/parser related TODOsBjørn Erik Pedersen
See #5324
2018-10-23herrors: Improve handling of JSON errorsBjørn Erik Pedersen
`*json.UnmarshalTypeError` and `*json.SyntaxError` has a byte `Offset`, so use that. This commit also reworks/simplifies the errror line matching logic. This also makes the file reading unbuffered, but that should be fine in this error case. See #5324
2018-10-22hugolib: Continue the file context/line number errors workBjørn Erik Pedersen
See #5324
2018-10-22Convert the rest to new page parser code pathsBjørn Erik Pedersen
And remove some now unused code. See #5324
2018-10-22parser/metadecoders: Consolidate the metadata decodersBjørn Erik Pedersen
See #5324
2018-10-21tpl: Update Jsonify to return pretty-print outputSean Prashad
Fixes #5040
2018-10-17tpl: Improve the Execute panic error messageBjørn Erik Pedersen
See #5327
2018-10-16commands: Show server error info in browserBjørn Erik Pedersen
The main item in this commit is showing of errors with a file context when running `hugo server`. This can be turned off: `hugo server --disableBrowserError` (can also be set in `config.toml`). But to get there, the error handling in Hugo needed a revision. There are some items left TODO for commits soon to follow, most notable errors in content and config files. Fixes #5284 Fixes #5290 See #5325 See #5324
2018-10-16tpl: Use .Lastmod in embedded schema templateAkshay Raj Gollahalli
Fixes #5320
2018-10-08common/maps: Improve append in ScratchBjørn Erik Pedersen
This commit consolidates the reflective collections handling in `.Scratch` vs the `tpl` package so they use the same code paths. This commit also adds support for a corner case where a typed slice is appended to a nil or empty `[]interface{}`. Fixes #5275
2018-10-07Revert "tpl: Fix baseof.html in error message"Bjørn Erik Pedersen
I need to rethink this. This reverts commit 646a52a5c5f52890f2d0270b68ba0f863047484a.
2018-10-06tpl: Fix baseof.html in error messageBjørn Erik Pedersen
This fix should also make the template loadin slightly faster, as we avoid to reparse the baseof.html files more than one time. Fixes #5288
2018-10-03Render Markdown in figure shortcode "caption" and "attr" paramsKaushal Modi
Fixes https://github.com/gohugoio/hugo/issues/4406.
2018-10-03Re-organize the figure shortcode for better readabilityKaushal Modi
2018-10-03tpl: Cast IsSet key to int for indexed typesCameron Moore
Don't assume that the user sends an int as the key when checking against indexed types. Fixes #3681
2018-10-02tpl/collections: Fix handling of different interface types in SliceBjørn Erik Pedersen
In Hugo `0.49` we improved type support in `slice`. This has an unfortunate side effect in that `resources.Concat` now expects something that can resolve to `resource.Resources`. This worked for most situations, but when you try to `slice` different `Resource` objects, you would be getting `[]interface {}` and not `resource.Resources`. And `concat` would fail: ```bash error calling Concat: slice []interface {} not supported in concat. ``` This commit fixes that by simplifying the type checking logic in `Slice`: * If the first item implements the `Slicer` interface, we try that * If the above fails or the first item does not implement `Slicer`, we just return the `[]interface {}` Fixes #5269
2018-10-02tpl: Add a delimiter parameter to lang.NumFmtCameron Moore
The original implementation of NumFmt did not take into account that the options delimiter (a space) could be a valid option. Adding a delim parameter seems like the simplest, safest, and most flexible way to solve this oversight in a backwards-compatible way. Fixes #5260
2018-09-22tpl/collections: Allow first function to return an empty sliceRicardo N Feliciano
Fixes #5235
2018-09-22tpl/opengraph: Use safeHTMLAttr instead of safeHTML for HTML attributesRicardo N Feliciano
Fixes #5236
2018-09-14tpl/collections: Add collections.AppendBjørn Erik Pedersen
Before this commit you would typically use `.Scratch.Add` to manually create slices in a loop. With variable overwrite in Go 1.11, we can do better. This commit adds the `append` template func. A made-up example: ```bash {{ $p1 := index .Site.RegularPages 0 }}{{ $p2 := index .Site.RegularPages 1 }} {{ $pages := slice }} {{ if true }} {{ $pages = $pages | append $p2 $p1 }} {{ end }} ``` Note that with 2 slices as arguments, the two examples below will give the same result: ```bash {{ $s1 := slice "a" "b" | append (slice "c" "d") }} {{ $s2 := slice "a" "b" | append "c" "d" }} ``` Both of the above will give `[]string{a, b, c, d}`. This commit also improves the type handling in the `slice` template function. Now `slice "a" "b"` will give a `[]string` slice. The old behaviour was to return a `[]interface{}`. Fixes #5190
2018-09-11tpl/data: Revise error handling in getJSON and getCSVBjørn Erik Pedersen
The most important part being: Log ERROR, but do not stop the build on remote errors. Fixes #5076
2018-09-11tpl: Show error on union or intersect of uncomparable typesCameron Moore
Fixes #3820
2018-09-10tpl/collections: Improve type handling in collections.SliceBjørn Erik Pedersen
Fixes #5188
2018-09-08tpl/collections: Allow pointer receiver in GroupBjørn Erik Pedersen
See #4865
2018-09-08tpl/collections: Add group template funcBjørn Erik Pedersen
This extends the page grouping in Hugo with a template function that allows for ad-hoc grouping. A made-up example: ``` {{ $cool := where .Site.RegularPages "Params.cool" true | group "cool" }} {{ $blue := where .Site.RegularPages "Params.blue" true | group "blue" }} {{ $paginator := .Paginate (slice $cool $blue) }} ``` Closes #4865
2018-09-07tpl/strings: Add strings.FirstUpperBjørn Erik Pedersen
Fixes #5174
2018-09-07tpl: Fix golint godoc issuesCameron Moore
2018-08-23tpl/tplimpl: Make the autogenerated templates collapsed in PRsBjørn Erik Pedersen
2018-08-19tpl/tplimpl: Fix .Site.Params case regressionBjørn Erik Pedersen
Fixes #5094
2018-08-17tpl/tplimpl: Fix compiling Amber templates that import other templates Steven Allen
Without this patch, amber would try to load templates from the OS filesystem instead of the layouts virtual filesystem.
2018-08-14tpl/tplimpl: Reimplement the ".Params tolower" template transformerBjørn Erik Pedersen
All `.Params` are stored lowercase, but it should work to access them `.Page.camelCase` etc. There was, however, some holes in the logic with the old transformer. This commit fixes that by applying a blacklist instead of the old whitelist logic. `.Param` is a very distinct key. The original case will be kept in `.Data.Params.myParam`, but other than that it will be lowercased. Fixes #5068
2018-08-12tpl: Suppress blank lines from opengraph internal templateAnthony Fok
2018-08-06tpl/tmplimpl: Add MIME type to embedded JSBjørn Erik Pedersen
So they get minified correctly. See #5042
2018-08-06Add support for minification of final outputBjørn Erik Pedersen
Hugo Pipes added minification support for resources fetched via ´resources.Get` and similar. This also adds support for minification of the final output for supported output formats: HTML, XML, SVG, CSS, JavaScript, JSON. To enable, run Hugo with the `--minify` flag: ```bash hugo --minify ``` This commit is also a major spring cleaning of the `transform` package to allow the new minification step fit into that processing chain. Fixes #1251
2018-08-06Remove alias of os.Statsatotake
2018-08-06Renmae FileStat Statsatotake
2018-08-06Fix typosatotake
2018-08-06Add fileStat to tpl/os/ossatotake
2018-07-31tpl/partials: Add templates.ExistsBjørn Erik Pedersen
Fixes #5010
2018-07-31tpl/partials: Remove superflous loopBjørn Erik Pedersen
No need to check the themes template prefix.
2018-07-18Add optional lang as argument to rel/relrefBjørn Erik Pedersen
Fixes #4956
2018-07-12Improve type support in resources.ConcatBjørn Erik Pedersen
This allows the result of `.Resources.Match` and similar to be concatenated. Fixes #4934