mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-29 07:00:31 +03:00
Add support for amber files
If a layout file ends with .amber it will interpreted as a Amber file Signed-off-by: Noah Campbell <noahcampbell@gmail.com>
This commit is contained in:
parent
ee5865f239
commit
ba82a20321
6 changed files with 171 additions and 108 deletions
|
@ -16,7 +16,6 @@ package hugolib
|
|||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"strings"
|
||||
"unicode"
|
||||
)
|
||||
|
@ -37,7 +36,7 @@ type ShortcodeWithPage struct {
|
|||
|
||||
type Shortcodes map[string]ShortcodeFunc
|
||||
|
||||
func ShortcodesHandle(stringToParse string, p *Page, t *template.Template) string {
|
||||
func ShortcodesHandle(stringToParse string, p *Page, t Template) string {
|
||||
posStart := strings.Index(stringToParse, "{{%")
|
||||
if posStart > 0 {
|
||||
posEnd := strings.Index(stringToParse[posStart:], "%}}") + posStart
|
||||
|
@ -124,7 +123,7 @@ func SplitParams(in string) (name string, par2 string) {
|
|||
return strings.TrimSpace(in[:i+1]), strings.TrimSpace(in[i+1:])
|
||||
}
|
||||
|
||||
func ShortcodeRender(name string, data *ShortcodeWithPage, t *template.Template) string {
|
||||
func ShortcodeRender(name string, data *ShortcodeWithPage, t Template) string {
|
||||
buffer := new(bytes.Buffer)
|
||||
t.ExecuteTemplate(buffer, "shortcodes/"+name+".html", data)
|
||||
return buffer.String()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue