Add inline shortcode support
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 26 Nov 2018 10:01:27 +0000 (11:01 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 27 Nov 2018 15:14:09 +0000 (16:14 +0100)
commitbc337e6ab5a75f1f1bfe3a83f3786d0afdb6346c
tree1f3b087822337acbde696147f18e86b2c9f1d8eb
parent112461fded0d7970817ce7bf476c4763922ad314
Add inline shortcode support

An inline shortcode's name must end with `.inline`, all lowercase.

E.g.:

```bash
{{< time.inline >}}{{ now }}{{< /time.inline >}}
```

The above will print the current date and time.

Note that an inline shortcode's inner content is parsed and executed as a Go text template with the same context as a regular shortcode template.

This means that the current page can be accessed via `.Page.Title` etc. This also means that there are no concept of "nested inline shortcodes".

The same inline shortcode can be reused later in the same content file, with different params if needed, using the self-closing syntax:

```
{{< time.inline />}}
```

Fixes #4011
common/herrors/file_error.go
hugolib/config.go
hugolib/shortcode.go
hugolib/shortcode_test.go
hugolib/site.go
parser/pageparser/item.go
parser/pageparser/pagelexer.go
parser/pageparser/pageparser_shortcode_test.go