hugo/hugolib
Bjørn Erik Pedersen 8b5b558bb5 tpl: Rework to handle both text and HTML templates
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-02 23:13:10 +02:00
..
testdata
404_test.go
alias.go tpl: Rework to handle both text and HTML templates 2017-04-02 23:13:10 +02:00
alias_test.go
author.go
case_insensitive_test.go
config.go Remove the now superflous defaultExtension 2017-03-27 15:43:56 +02:00
config_test.go
datafiles_test.go
disableKinds_test.go
embedded_shortcodes_test.go tpl: Rework to handle both text and HTML templates 2017-04-02 23:13:10 +02:00
gitinfo.go
handler_base.go
handler_file.go
handler_meta.go
handler_page.go
handler_test.go Remove the now superflous defaultExtension 2017-03-27 15:43:56 +02:00
hugo_info.go
hugo_sites.go tpl: Rework to handle both text and HTML templates 2017-04-02 23:13:10 +02:00
hugo_sites_build.go
hugo_sites_build_test.go hugolib, i18n: Update tests with flat format and TOML files 2017-04-02 18:43:32 +02:00
media.go
menu.go
menu_old_test.go hugolib: More TODO fixes 2017-03-27 15:43:56 +02:00
menu_test.go tpl: Rework to handle both text and HTML templates 2017-04-02 23:13:10 +02:00
multilingual.go
node_as_page_test.go
page.go tpl: Rework to handle both text and HTML templates 2017-04-02 23:13:10 +02:00
page_collections.go
page_output.go tpl: Rework to handle both text and HTML templates 2017-04-02 23:13:10 +02:00
page_paths.go hugolib: Fix panic for Permalink in 404 etc. templates 2017-03-27 15:43:56 +02:00
page_paths_test.go output: Rename HTMLType etc. to HTMLFormat 2017-03-27 15:43:56 +02:00
page_permalink_test.go Remove the now superflous defaultExtension 2017-03-27 15:43:56 +02:00
page_taxonomy_test.go
page_test.go Remove the now superflous defaultExtension 2017-03-27 15:43:56 +02:00
page_time_integration_test.go
pageCache.go
pageCache_test.go
pageGroup.go
pageGroup_test.go
pageSort.go
pageSort_test.go
pagesPrevNext.go
pagesPrevNext_test.go
pagination.go
pagination_test.go output: Rename HTMLType etc. to HTMLFormat 2017-03-27 15:43:56 +02:00
path_separators_test.go
permalinks.go
permalinks_test.go
robotstxt_test.go
rss_test.go
scratch.go
scratch_test.go
shortcode.go tpl: Rework to handle both text and HTML templates 2017-04-02 23:13:10 +02:00
shortcode_test.go tpl: Rework to handle both text and HTML templates 2017-04-02 23:13:10 +02:00
shortcodeparser.go
shortcodeparser_test.go
site.go tpl: Rework to handle both text and HTML templates 2017-04-02 23:13:10 +02:00
site_output.go output: Rename HTMLType etc. to HTMLFormat 2017-03-27 15:43:56 +02:00
site_output_test.go tpl: Rework to handle both text and HTML templates 2017-04-02 23:13:10 +02:00
site_render.go hugolib: Use Page Kind in template errors to prevent log spam 2017-04-02 12:22:54 +02:00
site_test.go tpl: Rework to handle both text and HTML templates 2017-04-02 23:13:10 +02:00
site_url_test.go
siteJSONEncode_test.go
sitemap.go
sitemap_test.go tpl: Rework to handle both text and HTML templates 2017-04-02 23:13:10 +02:00
taxonomy.go
taxonomy_test.go
template_engines_test.go
template_test.go
testhelpers_test.go tpl: Rework to handle both text and HTML templates 2017-04-02 23:13:10 +02:00
translations.go