hugo/hugolib
bep 55fcd2f30f Shortcode rewrite, take 2
This commit contains a restructuring and partial rewrite of the shortcode handling.

Prior to this commit rendering of the page content was mingled with handling of the shortcodes. This led to several oddities.

The new flow is:

1. Shortcodes are extracted from page and replaced with placeholders.
2. Shortcodes are processed and rendered
3. Page is processed
4. The placeholders are replaced with the rendered shortcodes

The handling of summaries is also made simpler by this.

This commit also introduces some other chenges:

1. distinction between shortcodes that need further processing and those who do not:

* `{{< >}}`: Typically raw HTML. Will not be processed.
* `{{% %}}`: Will be processed by the page's markup engine (Markdown or (infuture) Asciidoctor)

The above also involves a new shortcode-parser, with lexical scanning inspired by Rob Pike's talk called "Lexical Scanning in Go",
which should be easier to understand, give better error messages and perform better.

2. If you want to exclude a shortcode from being processed (for documentation etc.), the inner part of the shorcode must be commented out, i.e. `{{%/* movie 47238zzb */%}}`. See the updated shortcode section in the documentation for further examples.

The new parser supports nested shortcodes. This isn't new, but has two related design choices worth mentioning:

* The shortcodes will be rendered individually, so If both `{{< >}}` and `{{% %}}` are used in the nested hierarchy, one will be passed through the page's markdown processor, the other not.
* To avoid potential costly overhead of always looking far ahead for a possible closing tag, this implementation looks at the template itself, and is branded as a container with inner content if it contains a reference to `.Inner`

Fixes #565
Fixes #480
Fixes #461

And probably some others.
2014-11-17 18:32:06 -05:00
..
benchmark_test.go permitting empty files again. Fixing some tests to now pass. 2014-05-01 14:11:56 -04:00
handler_file.go Adding a proper css file handler (with automatic minification) 2014-11-04 00:42:36 -05:00
handler_page.go Adding an html file handler 2014-11-04 00:43:09 -05:00
handlers.go Handler WIP 2014-11-01 12:05:37 -04:00
menu.go Implement HasMenuCurrent and IsMenuCurrent for Nodes 2014-11-01 22:34:49 -04:00
menu_test.go Updating tests to use new Targets & Writers and switch to using Afero.MemMapFs for more accurate tests. 2014-11-04 00:41:47 -05:00
node.go Implement HasMenuCurrent and IsMenuCurrent for Nodes 2014-11-01 22:34:49 -04:00
page.go Shortcode rewrite, take 2 2014-11-17 18:32:06 -05:00
page_permalink_test.go Big refactor of how source files are used. Also added default destination extension option. 2014-10-16 20:20:09 -04:00
page_taxonomy_test.go fix tags not being in lowercase, #491 2014-09-11 17:03:31 -04:00
page_test.go Shortcode rewrite, take 2 2014-11-17 18:32:06 -05:00
page_time_integration_test.go permitting empty files again. Fixing some tests to now pass. 2014-05-01 14:11:56 -04:00
pageGroup.go Fix GroupBy function issues 2014-11-13 22:48:58 -05:00
pageGroup_test.go Fix GroupBy function issues 2014-11-13 22:48:58 -05:00
pageSort.go Add sort and grouping functions for publish date and param of Page 2014-11-01 22:41:04 -04:00
path_seperators_test.go converted path 2 filepath 2014-11-13 22:38:21 -05:00
path_seperators_windows_test.go Add Disqus support out of the box. Move template/bundle into hugolib. 2014-04-23 02:53:12 -04:00
permalinks.go Change permalink validation and substitution. 2014-11-02 00:43:01 -04:00
permalinks_test.go Change permalink validation and substitution. 2014-11-02 00:43:01 -04:00
planner.go New targets & new renderers and write methods [WIP] 2014-11-04 00:39:37 -05:00
redis.cn.md Adding benchmark for parsing pages using unicode. 2013-08-09 17:36:32 -07:00
rss_test.go Updating tests to use new Targets & Writers and switch to using Afero.MemMapFs for more accurate tests. 2014-11-04 00:41:47 -05:00
shortcode.go Shortcode rewrite, take 2 2014-11-17 18:32:06 -05:00
shortcode_test.go Shortcode rewrite, take 2 2014-11-17 18:32:06 -05:00
shortcodeparser.go Shortcode rewrite, take 2 2014-11-17 18:32:06 -05:00
shortcodeparser_test.go Shortcode rewrite, take 2 2014-11-17 18:32:06 -05:00
site.go Fix a bug with taxonomy rendering. 2014-11-13 12:32:10 -05:00
site_show_plan_test.go Updating tests to use new Targets & Writers and switch to using Afero.MemMapFs for more accurate tests. 2014-11-04 00:41:47 -05:00
site_test.go Updating tests to use new Targets & Writers and switch to using Afero.MemMapFs for more accurate tests. 2014-11-04 00:41:47 -05:00
site_url_test.go Updating tests to use new Targets & Writers and switch to using Afero.MemMapFs for more accurate tests. 2014-11-04 00:41:47 -05:00
siteinfo_test.go Fix permalink functionality, which was broken in 62dd1d4. 2014-05-12 15:47:52 -04:00
sitemap.go Add Sitemaps config values handling 2014-05-09 23:11:33 -04:00
sitemap_test.go Updating tests to use new Targets & Writers and switch to using Afero.MemMapFs for more accurate tests. 2014-11-04 00:41:47 -05:00
summary.go Big refactor of how source files are used. Also added default destination extension option. 2014-10-16 20:20:09 -04:00
taxonomy.go Sort by title if dates are the same 2014-09-11 17:23:01 -04:00
taxonomy_test.go permitting empty files again. Fixing some tests to now pass. 2014-05-01 14:11:56 -04:00
template.go Shortcode rewrite, take 2 2014-11-17 18:32:06 -05:00
template_embedded.go Fix missing space before 'width' 2014-11-13 12:29:06 -05:00
template_test.go Make Where template-method accept methodname as key 2014-11-13 12:42:26 -05:00