summaryrefslogtreecommitdiffstats
path: root/hugolib/shortcode_test.go
AgeCommit message (Collapse)Author
2017-07-04output: Support templates per site/languageBjørn Erik Pedersen
This applies to both regular templates and shortcodes. So, if the site language is French and the output format is AMP, this is the (start) of the lookup order for the home page: 1. index.fr.amp.html 2. index.amp.html 3. index.fr.html 4. index.html 5. ... Fixes #3360
2017-06-13all: Update textual references in Go source to point to gohugoio/hugoBjørn Erik Pedersen
2017-06-13all: Update import paths to gohugoio/hugoBjørn Erik Pedersen
2017-05-13hugolib: Handle shortcode per output formatBjørn Erik Pedersen
This commit allows shortcode per output format, a typical use case would be the special AMP media tags. Note that this will only re-render the "overridden" shortcodes and only in pages where these are used, so performance in the normal case should not suffer. Closes #3220
2017-04-02tpl: Rework to handle both text and HTML templatesBjørn Erik Pedersen
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-02Revert "tpl: Rework to handle both text and HTML templates"Bjørn Erik Pedersen
Will have to take another stab at this ... This reverts commit 5c5efa03d2512749950b0d05a7d4bde35ecbdc37. Closes #3260
2017-04-02tpl: Rework to handle both text and HTML templatesBjørn Erik Pedersen
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-03-27Remove the now superflous defaultExtensionBjørn Erik Pedersen
And some other unsed fields and methods.
2017-03-27hugolib, output: Add theme logic to LayoutHandlerBjørn Erik Pedersen
2017-03-11hugolib: Fix reloading corner cases for shortcodesBjørn Erik Pedersen
This commit fixes two different, but related issues: 1) Live-reload when a new shortcode was defined in the content file before the shortcode itself was created. 2) Live-reload when a newly defined shortcode changed its "inner content" status. This commit also improves the shortcode related error messages to include the full path to the content file in question. Fixes #3156
2017-02-22hugolib: Fix broken shortcode testsBjørn Erik Pedersen
2017-02-18hugolib: More test helper cleanupBjørn Erik Pedersen
2017-02-17hugolib: Test helper cleanupBjørn Erik Pedersen
2017-02-17tpl: Refactor packageBjørn Erik Pedersen
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
2017-02-17all: Refactor to nonglobal Viper, i18n etc.Bjørn Erik Pedersen
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
2017-02-04all: Refactor to nonglobal file systemsBjørn Erik Pedersen
Updates #2701 Fixes #2951
2017-01-10 all: Refactor to nonglobal template handlingBjørn Erik Pedersen
Updates #2701
2017-01-07all: Refactor to non-global loggerBjørn Erik Pedersen
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
2017-01-05hugolib: Correct usage of "shortcode" in error messagesmagikstm
2017-01-01Fix Appveyor Windows build and GitInfo path issue on WindowsDavid Kassa
2016-11-23hugolib: SimplifyBjørn Erik Pedersen
2016-11-22node to page: Remove NodeBjørn Erik Pedersen
And misc. TODO-fixes Updates #2297
2016-11-22node to page: Make Nodes into PagesBjørn Erik Pedersen
* `.Site.Pages` now contains all page types, including sections etc. * `.Data.Pages` will also contain "node type" pages where relevant. Updates #2297
2016-10-24all: Unify case of config variable namesAlbert Nigmatzianov
All config variables starts with low-case and uses camelCase. If there is abbreviation at the beginning of the name, the whole abbreviation will be written in low-case. If there is abbreviation at the end of the name, the whole abbreviation will be written in upper-case. For example, rssURI.
2016-10-15Fix pygments check in testBjørn Erik Pedersen
2016-10-15Make the pygments shortcode test matching less specificBjørn Erik Pedersen
So it does not fail on "other" pygments versions.
2016-09-08Fix shortcode vs pygmentsBjørn Erik Pedersen
This is the nth attempt to fix an issue by changing the placeholder token pattern, but now we actually have tests for all the historic trouble cases. Fixes #2223
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-06Render the shortcodes as late as possibleBjørn Erik Pedersen
This is needed to make shortcode users happy with the new multilanguage support, but it will also solve many other related posts about "stuff not available in the shortcode". We will have to revisit this re the handler chain at some point, but that will be easier now as the integration test story has improved so much. As part of this commit, the site-building tests in page_test.go is refreshed, they now tests for all the rendering engines (when available), and all of them now uses the same code-path as used in production. Fixes #1229 Fixes #2323 Fixes ##1076
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-06Introduce HugoSites typeBjørn Erik Pedersen
And a Hugo global variable which contains the site under build. This is really needed to get some level of control of the "multiple languages" in play. There are still work related to this scattered around, but that will come. With this commit, the multilingual feature is starting to work.
2016-07-21Fix broken shortcode testBjørn Erik Pedersen
See #2249
2016-07-21Add "missing slice" to the Params testBjørn Erik Pedersen
See #2249
2016-07-21Check for nil Params in shortcode's GetBjørn Erik Pedersen
Fixes #2294
2016-07-21Add shortcode null param variantBjørn Erik Pedersen
See #2294
2016-07-20Add shortcode test for mmarkBjørn Erik Pedersen
2016-07-04Add Rst shortcode testBjørn Erik Pedersen
Fixes #2253
2016-07-04Add Asciidoc shortcode testBjørn Erik Pedersen
Fixes #2249
2016-06-26Add test for shortcode in fenced code blockBjørn Erik Pedersen
Which I expected to fail, but it doesn't ... See #2223
2016-06-15Fix shortcode in markdown headersBjørn Erik Pedersen
This issue was introduced as a fix to shortcode not working in RST. One could argue that Blackfriday and friends should handle `#` in titles, but that will be a discussion for another day. The new placeholder pattern should be RST safe and work with titles. And now with a test so this doesn't break again. Fixes #2192 Fixes #2209 Closes #2210
2016-04-12Fix broken testsBjørn Erik Pedersen
2016-04-12Revert "Use Node.ID for anchor ID"Bjørn Erik Pedersen
This reverts commit cd558958a0c0ecd06f7560a38e27334fe983e0de.
2016-04-11Use Node.ID for anchor IDBjørn Erik Pedersen
Fixes #2057
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
2016-03-24hugolib: Even more Golint fixesBjørn Erik Pedersen
2016-03-23hugolib: Fix some more Golint warningsBjørn Erik Pedersen
2016-03-22hugolib: Use field keys in composite literalsCameron Moore
Small fix in shortcode tests to use field keys in a composite literal.
2016-03-13Make tests green on both Pygments 2.0.2 and 2.1.3Bjørn Erik Pedersen
See #1969
2016-03-09Create template clone for late template executionBjørn Erik Pedersen
Fixing some breaking blogs on Go 1.6 Fixes #1879