summaryrefslogtreecommitdiffstats
path: root/tpl
AgeCommit message (Collapse)Author
2016-09-12tpl: Extend where to iterate over mapsCameron Moore
Fixes #2028
2016-09-12tpl: Fix typos in testsCameron Moore
Closes #2370
2016-09-11Remove redundant field in sort helper structBen Campbell
The pair struct used by sortSeq() had two key fields, where only one is really needed.
2016-09-09tpl: Make it more clear on missing language stringBjørn Erik Pedersen
2016-09-08Reset the i18n func map on reloadBjørn Erik Pedersen
Also improve the error message on missing resource bundles.
2016-09-07tpl: Fix echoParamBjørn Erik Pedersen
Fixes #2406
2016-09-06Improve i18n string handlingBjørn Erik Pedersen
* Fall back to default language on missing translation file * Add a i18n-warnings build flag * If that flag is set, print a parseable and greppable string on missing translation strings See #2303
2016-09-06Render main content language in root by defaultBjørn Erik Pedersen
Fixes #2312
2016-09-06Improve language handling in URLsBjørn Erik Pedersen
The current "rendering language" is needed outside of Site. This commit moves the Language type to the helpers package, and then used to get correct correct language configuration in the markdownify template func. This commit also adds two new template funcs: relLangURL and absLangURL. See #2309
2016-09-06Make it possible to configure Blackfroday per languageBjørn Erik Pedersen
See #2309
2016-09-06Add sitemap index for multilingual sitesBjørn Erik Pedersen
See #2309
2016-09-06Optimize the multilanguage build processBjørn Erik Pedersen
Work In Progress! This commit makes a rework of the build and rebuild process to better suit a multi-site setup. This also includes a complete overhaul of the site tests. Previous these were a messy mix that were testing just small parts of the build chain, some of it testing code-paths not even used in "real life". Now all tests that depends on a built site follows the same and real production code path. See #2309 Closes #2211 Closes #477 Closes #1744
2016-09-06Add Translations and AllTranslations to NodeBjørn Erik Pedersen
This commit also consolidates URLs on Node vs Page, so now .Permalink should be interoperable. Note that this implementations should be fairly short-livded, waiting for #2297, but the API should be stable.
2016-09-06Rework the i18n template func handlingBjørn Erik Pedersen
Setting the language to use when loading the language bundles just doesn't work. The template system is unfortanetely a global, and the last languate processed won ...
2016-09-06Add multilingual support in HugoAlexandre Bourget
Implements: * support to render: * content/post/whatever.en.md to /en/2015/12/22/whatever/index.html * content/post/whatever.fr.md to /fr/2015/12/22/whatever/index.html * gets enabled when `Multilingual:` is specified in config. * support having language switchers in templates, that know where the translated page is (with .Page.Translations) (when you're on /en/about/, you can have a "Francais" link pointing to /fr/a-propos/) * all translations are in the `.Page.Translations` map, including the current one. * easily tweak themes to support Multilingual mode * renders in a single swift, no need for two config files. Adds a couple of variables useful for multilingual sites Adds documentation (content/multilingual.md) Added language prefixing for all URL generation/permalinking see in the code base. Implements i18n. Leverages the great github.com/nicksnyder/go-i18n lib.. thanks Nick. * Adds "i18n" and "T" template functions..
2016-08-20tpl: Add missing arg to FatalfBjørn Erik Pedersen
2016-08-16tpl: Return all errors from castingCameron Moore
Most non-boolean template functions should return errors. Fixes #2354
2016-08-13tpl: Fix faulty ordering of relURL test casesBjørn Erik Pedersen
2016-08-13tpl: Make absURL and relURL accept anythingStephan Kulla
2016-08-04tpl: Fix typo in FindRE testdigitalcraftsman
2016-08-04Fix the time template func testBjørn Erik Pedersen
By making it not depend on the locale setup.
2016-08-04tpl: Add time template func Wade Fitzpatrick
Fixes #2328
2016-07-30Take 2: Load templates from the Afero source fsBjørn Erik Pedersen
See #2321
2016-07-30Load templates from the Afero source fsBjørn Erik Pedersen
Fixes #2321
2016-07-30Use the Afero source fs where relevantBjørn Erik Pedersen
Fixes #2319
2016-07-19Add `htmlEscape` and `htmlUnescape` template functionsCathal Garvey
These functions allow trivial escaping and unescaping of HTML entities, and make it far easier to compose other functions for the creation of parameterised URLs.
2016-07-14tpl: Add humanize examples to smoke testsBjørn Erik Pedersen
2016-07-14Do not double-escape in querifyCathal Garvey
Test case modified and expanded for querify to reflect original bug and changes. Fixes #2279
2016-07-13tpl: Modify tpl.humanize to ordinalize integer inputMichael Orr
Add logic to tpl.humanize such that it understands input of int literals or strings which represent an integer. When tpl.humanize sees this type of input, it will use inflect.Ordinalize as opposed to the standard inflect.Humanize. Fixes #1886
2016-07-10Fix humanize when string is emptyBjørn Erik Pedersen
Fixes #2272
2016-07-06Simplify querifyBjørn Erik Pedersen
2016-07-05tpl: Add a querify function to generate query strings inside templatesJimmy Sawczuk
The query function will take a set of parameters specified like a dict and return a url.Values object which can be .Encode'd into a query string. Example: <a href="http://www.google.com?{{ (querify "q" "test" "page" 3).Encode | safeHTML }}">Search</a> Returns: <a href="http://www.google.com?page=3&q=test">Search</a> Closes #2257
2016-06-27tpl: Enable safeHTMLAttrmarco
See #2234 and #347
2016-05-09Fix broken template testBjørn Erik Pedersen
2016-05-06Add non-string support in markdownifyBjørn Erik Pedersen
2016-04-28tpl: Add intersect operator to where functionChristopher Mancini
Returns true if a given field value that is a slice / array of strings, integers or floats contains elements in common with the matching value. It follows the same rules as the intersect function. Closes #1945
2016-04-14tpl: Do not write to cache when ignoring cacheRobert Basic
Fixes #2067 Closes #2069
2016-04-13Revert "tpl: Extend where to iterate over maps"Bjørn Erik Pedersen
Committed by accident. This reverts commit 0141a02160ee7b91642d3c3475959d6742ccd693.
2016-04-13tpl: Extend where to iterate over mapsCameron Moore
Refactor and extend where to iterate over maps.
2016-04-08tpl: Add replaceRE to the "smoke tests"digitalcraftsman
Fixes #2063
2016-04-08Make Hugo build without MercurialBjørn Erik Pedersen
By creating a fork of the Bitbucket inflect repo. It hasn't changed since 2013, so it must be considered pretty stable. Fixes #2062
2016-04-05tpl: Add findRE template funcdigitalcraftsman
2016-04-03tpl: Add the other test case for hasPrefixBjørn Erik Pedersen
2016-04-03tpl: Sort the smoke testsBjørn Erik Pedersen
2016-04-03tpl: Add hasPrefix to the template funcs' "smoke test"digitalcraftsman
2016-04-02tpl: Fix panic in sort of nil sequenceCameron Moore
Properly handle a nil sequence in the sortSeq function. Test included. Discovered while using `range sort .Site.Data.source.Undefined "foo"`.
2016-04-02tpl: Fix panic in pairList.LessCameron Moore
While sorting on data sources with missing fields, a panic can occur in pairList.Less if `Interface()` is called on a invalid `reflect.Value`. This commit detects an invalid Value and replacing it with a zero value for the comparison.
2016-03-31docs: Add doc and a test for readDirBjørn Erik Pedersen
Fixes #2009
2016-03-31tpl: Make readDir use the WorkingDir fsBjørn Erik Pedersen
Fixes #2010
2016-03-31Add readFile template funcBjørn Erik Pedersen
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