Age | Commit message (Collapse) | Author |
|
This commit also removes support for Ace and Amber templates.
Updates #6594
|
|
|
|
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
|
|
Now:
* The template API lives in /tpl
* The rest lives in /tpl/tplimpl
This is bound te be more improved in the future.
Updates #2701
|
|
This is a final rewrite that removes all the global state in Hugo, which also enables
the use if `t.Parallel` in tests.
Updates #2701
Fixes #3016
|
|
Fixes #3032
|
|
Updates #2701
Fixes #2951
|
|
Updates #2701
|
|
Note that this looks like overkill for just the logger, and that is correct,
but this will make sense once we start with the template handling etc.
Updates #2701
|
|
This also includes a refactor of the hugofs package and its usage.
The motivation for that is:
The Afero filesystems are brilliant. Hugo's way of adding a dozen of global variables for the different filesystems was a mistake. In readFile (and also in some other places in Hugo today) we need a way to restrict the access inside the working dir. We could use ioutil.ReadFile and implement the path checking, checking the base path and the dots ("..") etc. But it is obviously better to use an Afero BasePathFs combined witha ReadOnlyFs. We could create a use-once-filesystem and handle the initialization ourselves, but since this is also useful to others and the initialization depends on some other global state (which would mean to create a new file system on every invocation), we might as well do it properly and encapsulate the predefined set of filesystems. This change also leads the way, if needed, to encapsulate the file systems in a struct, making it possible to have several file system sets in action at once (parallel multilanguage site building? With Moore's law and all...)
Fixes #1551
|
|
|
|
NOTE: Needs Go 1.6 to use the new feature.
Fixes #1832
|
|
See #1771
|
|
See #1771
|
|
See #1646
|
|
See #1178
|
|
Fixed #1098
|
|
Fixes #1095
|
|
Fixes #1092
|
|
Fixes #1091
|
|
Fixes #1090
|
|
Fixes #1089
|
|
The template funcs get their own file. This prevents having to scroll miles to get to the template infrastructure.
|
|
Fixes #1025
|
|
Makes for a better template api.
|
|
Its behavior is similar to that in JavaScript
with special handling of negative length as found in in PHP.
Fixes #991
|
|
Fixes #990
|
|
That is whas was implemented, not Substr.
Also make the API more similar to Go's internal slice by making both the start and end indices optional.
See #990
|
|
|
|
Both of these can take any type the cast lib can turn into a string.
|
|
|
|
Thanks to @bep's new, brilliant helpers.Deprecated() function,
the following functions or variables are transitioned to their
new names, preserving backward compatibility for v0.14
and warning the user of upcoming obsolescence in v0.15:
* .Url → .URL (for node, menu and paginator)
* .Site.BaseUrl → .Site.BaseURL
* .Site.Indexes → .Site.Taxonomies
* .Site.Recent → .Site.Pages
* getJson → getJSON
* getCsv → getCSV
* safeHtml → safeHTML
* safeCss → safeCSS
* safeUrl → safeURL
Also fix related initialisms in strings and comments.
Continued effort in fixing #959.
|
|
First step to use initialisms that golint suggests,
for example:
Line 116: func GetHtmlRenderer should be GetHTMLRenderer
as see on http://goreportcard.com/report/spf13/hugo
Thanks to @bep for the idea!
Note that command-line flags (cobra and pflag)
as well as struct fields like .BaseUrl and .Url
that are used in Go HTML templates need more work
to maintain backward-compatibility, and thus
are NOT yet dealt with in this commit.
First step in fixing #959.
|
|
|
|
We might have to take precision into account for floating point nubers ... at some point.
|
|
See #961
|
|
|
|
|
|
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.
|
|
This is the implementation of the proposal at #235 and
http://discuss.gohugo.io/t/parsing-dates-in-templates/603/3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- Add `safeUrl` template function (Fixes #347)
- Add TestSafeUrl() fashioned after @tatsushid great examples
- Disable `safeHtmlAttr` pending further discussions on its other
use cases because `safeUrl` is a cleaner solution to #347.
(There are also `safeJs` and `safeJsStr` that we could implement
if there are legitimate demands for them.)
- Rename `safeCSS` to `safeCss` (to follow the convention of `safeHtml`)
- Add/expand documentation on `safeHtml`, `safeCss` and `safeUrl`
|
|
This allows a template user to keep a safe HTML attribute or CSS string
as is in a template.
This is implementation of @anthonyfok great insight
Fix #784, #347
|