Commit graph

8 commits

Author SHA1 Message Date
Ahsanul Haque 14bce119b6 Commented helpers package 2014-12-18 22:18:36 -05:00
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
LK4D4 2194cc77de Add pygmentsstyle and pygmentsuseclasses options
Fixes #204

Conflicts:
	commands/hugo.go
2014-05-09 23:20:11 -04:00
LordFPL b52e946381 Little syntax mistake 2014-04-26 23:03:20 -06:00
spf13 e50b9d8ac1 Adding support for logging & verbose logging. Consolidation of error handling. Integration of jWalterWeatherman library. Fixed #137 2014-03-31 13:23:34 -04:00
Tibor Vass 6dd2e9a49a gofmt all go code 2014-01-29 18:03:35 -05:00
spf13 01da9a40e6 Report error, but don’t fatally stop if pygments has error. Return original string. (+1 squashed commit)
Squashed commits:
[849a7af] if highlighting doesn’t work, just return original string
2014-01-10 21:28:48 -05:00
spf13 fa29e94edb Adding Pygments helper 2013-12-05 09:42:29 -05:00