mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-18 21:11:19 +02:00
Code reorg, helpers.go has been decomposed.
It started with wanting to move templates in template bundles and the rest followed. I did my best to start grouping related functions together, but there are some that I missed. There is also the method Urlize that seems to be a special function used in both worlds. I'll need to revisit this method.
This commit is contained in:
@@ -16,6 +16,7 @@ package hugolib
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"github.com/spf13/hugo/template/bundle"
|
||||
"strings"
|
||||
"unicode"
|
||||
)
|
||||
@@ -36,7 +37,7 @@ type ShortcodeWithPage struct {
|
||||
|
||||
type Shortcodes map[string]ShortcodeFunc
|
||||
|
||||
func ShortcodesHandle(stringToParse string, p *Page, t Template) string {
|
||||
func ShortcodesHandle(stringToParse string, p *Page, t bundle.Template) string {
|
||||
posStart := strings.Index(stringToParse, "{{%")
|
||||
if posStart > 0 {
|
||||
posEnd := strings.Index(stringToParse[posStart:], "%}}") + posStart
|
||||
@@ -123,7 +124,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) string {
|
||||
func ShortcodeRender(name string, data *ShortcodeWithPage, t bundle.Template) string {
|
||||
buffer := new(bytes.Buffer)
|
||||
t.ExecuteTemplate(buffer, "shortcodes/"+name+".html", data)
|
||||
return buffer.String()
|
||||
|
Reference in New Issue
Block a user