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:
Fabrizio (Misto) Milo 2013-08-31 17:47:21 -07:00 committed by Noah Campbell
parent ee5865f239
commit ba82a20321
6 changed files with 171 additions and 108 deletions

View file

@ -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()