Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2015-06-25Add support for baseof.ace templates in themes.Jonathan Anderson
When we find a template that requires a base template, we should also look for that base template in the current theme. Fixes #1215.
2015-05-31Fix Windows Ace path issuebep
Ace doesn't like Windows style filepath separators. Fixes #1178
2015-05-31Add some Ace test casesbep
See #1178
2015-05-29Extract Ace handling to a methodbep
To prepare for some testing. See #1178
2015-04-18Expand the ACE base template lookup patternbep
The previous implementation didn't easily support the use case "I want one base template for the single pages, another for the rest". The new lookup order is: 1. <current-path>/<template-name>-baseof.ace, e.g. list-baseof.ace 2. <current-path>/baseof.ace 3. _default/<template-name>-baseof.ace, e.g. list-baseof.ace. 4. _default/baseof.ace
2015-04-05tpl: split template.gobep
The template funcs get their own file. This prevents having to scroll miles to get to the template infrastructure.
2015-04-01Remove paragraph tags produced by markdownifybep
Fixes #1025
2015-03-29Handle views in combo with Ace base templatesbep
As views looks like a regular template, but doesn't need a base template, we have to look inside it. Altough really not needed by this commit, reading the full file content into memory just to do a substring search is a waste. So this commit implements a `ReaderContains` func that in most cases should be much faster than doing an `ioutil.ReadAll` and `bytes.Contains`: ``` benchmark old ns/op new ns/op delta BenchmarkReaderContains 78452 20260 -74.18% benchmark old allocs new allocs delta BenchmarkReaderContains 46 20 -56.52% benchmark old bytes new bytes delta BenchmarkReaderContains 46496 1258 -97.29% ``` Fixes #999
2015-03-26Add support for Ace base and inner templatesbep
Fixes #994 Fixes #511
2015-03-23Change to variadic int args in Slicestrbep
Makes for a better template api.
2015-03-23Implement substr template functionAnthony Fok
Its behavior is similar to that in JavaScript with special handling of negative length as found in in PHP. Fixes #991
2015-03-23Rename Slice to Slicestrbep
Fixes #990
2015-03-23Polish Slice docbep
2015-03-23Rename Substr to Slicebep
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
2015-03-22Add Substr and Split template functionsXin Fan
Both of these can take any type the cast lib can turn into a string.
2015-03-18template: add some missing test cases for Firstbep
2015-03-18More initialism corrections (golint)Anthony Fok
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.
2015-03-16Add "getenv" as an wrapper for os.Getenvquoha
Add a wrapper for the os.Getenv function. The wrapper takes as input a string that is assumed to be an exported variable name. Fixes #977
2015-03-13Add Seq template funcbep
Very similar to GNU's seq. Fixes #552 Conflicts: tpl/template.go
2015-03-11Correct initialisms as suggested by golintAnthony Fok
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.
2015-03-10Do not parse backup files with trailing '~' as templatesAnthony Fok
Fixes #964
2015-03-09Fix eq and ne tpl function issueTatsushi Demachi
`eq` and `ne` template functions don't work as expected when those are used with a raw number and a calculated value by add, sub etc. It's caused by both numbers type differences. For example, `eq 5 (add 2 3)` returns `false` because raw 5 is `int` while `add 2 3` returns 5 with `int64` This normalizes `int`, `uint` and `float` type values to `int64`, `uint64` and `float64` before comparing them. Other type of value is passed to comparing function without any changes. Fix #961
2015-03-06Fix errors reported by Go Vetbep
2015-02-18Suppress errors for symbolic links witch point to a file.René Jochum
2015-02-17Adding getJson and getCsv to funcMapCyrill Schumacher
2015-02-01Print template parsing errors to aid troubleshootingAnthony Fok
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-30template render with BBPspf13
2015-01-22Revert "Quick-and-dirty way to print details of template errors"bep
This reverts commit 42b33102cf619e08c6b6a49a50a0995e8f14773f.
2015-01-22Add dateFormat template functionTatsushi Demachi
This is the implementation of the proposal at #235 and http://discuss.gohugo.io/t/parsing-dates-in-templates/603/3
2015-01-20Add inline doc for Applybep
2015-01-20Rename ignoreDotFile to isDotFile (which is what it is)bep
2015-01-20Replace regexp based Chomp with builtin TrimRightbep
2015-01-20Quick-and-dirty way to print details of template errorsAnthony Fok
See Issue #316.
2015-01-20Add `safeUrl`; disable `safeHtmlAttr`; rename `safeCSS` to `safeCss`Anthony Fok
- 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`
2015-01-20Add SafeHtmlAttr, SafeCSS template functionTatsushi Demachi
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
2015-01-18Make all the params to Replace an interface{}bep
2015-01-18Rewrite first argument to interface{}Tom Helmer Hansen
2015-01-18Add trim and replace template functionsTom Helmer Hansen
2015-01-08Fix `echoParam` template function to accept string key nameTatsushi Demachi
This changes `echoParam` template function behavior to accept not only an array or a slice and its index pair but also a map and its key pair. This also changes the function that float and uint values are treated as a valid result type of it. Fix #771
2015-01-04Add operator argument to `where` template functionTatsushi Demachi
It allows to use `where` template function like SQL `where` clause. For example, {{ range where .Data.Pages "Type" "!=" "post" }} {{ .Content }} {{ end }} Now these operators are implemented: =, ==, eq, !=, <>, ne, >=, ge, >, gt, <=, le, <, lt, in, not in It also fixes `TestWhere` more readable
2015-01-02Implement `apply`.Austin Ziegler
- apply seq fn args…
2015-01-02Add a chomp function.Austin Ziegler
- Mostly useful in pipelines.
2015-01-02Initialize funcMap in an init function.Austin Ziegler
2015-01-02Hygiene: Reduce copy-pasted code.Austin Ziegler
2014-12-29Refactor tpl codesTatsushi Demachi
- Use indirect function instead of the same code copies - Fix missing arguments of some test codes
2014-12-29Make 'where' template function accepts dot chaining key argumentTatsushi Demachi
'where' template function used to accept only each element's struct field name, method name and map key name as its second argument. This extends it to accept dot chaining key like 'Params.foo.bar' as the argument. It evaluates sub elements of each array elements and checks it matches the third argument value. Typical use case would be for filtering Pages by user defined front matter value. For example, to filter pages which have 'Params.foo.bar' and its value is 'baz', it is used like {{ range where .Data.Pages "Params.foo.bar" "baz" }} {{ .Content }} {{ end }} It ignores all leading and trailing dots so it can also be used with ".Params.foo.bar"
2014-12-26Add configurable support for angled quotesbep
The flag `HTML_SMARTYPANTS_ANGLED_QUOTES` was added to Blackfriday on Black Friday. This configures rendering of double quotes as angled left and right quotes (&laquo; &raquo;). Typical use cases would be either or, or combined, but never in the same document. As an example would be a person from Norway; he has a blog in both English and Norwegian (his native tongue); he would then configure Blackfriday to use angled quotes for the Norwegian section, but keep them as reqular double quotes for the English. This commit adds configuration support for this new flag, configuration that can be set in the site configuration, but overridden in page front matter. Fixes #605
2014-12-19Added delimit & sort template functions, tests and docsDerek Perkins
2014-12-19Provide (relative) reference funcs & shortcodes.Austin Ziegler
- `.Ref` and `.RelRef` take a reference (the logical filename for a page, including extension and/or a document fragment ID) and return a permalink (or relative permalink) to the referenced document. - If the reference is a page name (such as `about.md`), the page will be discovered and the permalink will be returned: `/about/` - If the reference is a page name with a fragment (such as `about.md#who`), the page will be discovered and used to add the `page.UniqueID()` to the resulting fragment and permalink: `/about/#who:deadbeef`. - If the reference is a fragment and `.*Ref` has been called from a `Node` or `SiteInfo`, it will be returned as is: `#who`. - If the reference is a fragment and `.*Ref` has been called from a `Page`, it will be returned with the page’s unique ID: `#who:deadbeef`. - `.*Ref` can be called from either `Node`, `SiteInfo` (e.g., `Node.Site`), `Page` objects, or `ShortcodeWithPage` objects in templates. - `.*Ref` cannot be used in content, so two shortcodes have been created to provide the functionality to content: `ref` and `relref`. These are intended to be used within markup, like `[Who]({{% ref about.md#who %}})` or `<a href="{{% ref about.md#who %}}">Who</a>`. - There are also `ref` and `relref` template functions (used to create the shortcodes) that expect a `Page` or `Node` object and the reference string (e.g., `{{ relref . "about.md" }}` or `{{ "about.md" | ref . }}`). It actually looks for `.*Ref` as defined on `Node` or `Page` objects. - Shortcode handling had to use a *differently unique* wrapper in `createShortcodePlaceholder` because of the way that the `ref` and `relref` are intended to be used in content.
2014-12-10ERROR-log on symbolic linksbep
filepath.Walk does not follow symbolic links. There's no easy fix for that outside of Go, so the best we can do for now is to give notice to the end user by ERROR log statements. This commit also fixes a related panic situation in GenerateTemplateNameFrom when the layout dir was a symbolic link. Fixes #283