hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit be46a4b9b03df85f786866da7a3a657f978a26bd
parent bed053071e3b521b0a915af07fc20a282c50dd9b
Author: bep <bjorn.erik.pedersen@gmail.com>
Date:   Sat, 18 Apr 2015 00:40:54 +0200

Polish func naming in shortcode handling

Diffstat:
Mhugolib/shortcode.go | 14+++++++-------
Mhugolib/shortcode_test.go | 2+-
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/hugolib/shortcode.go b/hugolib/shortcode.go
@@ -118,9 +118,9 @@ func (sc shortcode) String() string {
 	return fmt.Sprintf("%s(%q, %t){%s}", sc.name, params, sc.doMarkup, sc.inner)
 }
 
-// ShortcodesHandle does all in  one go: extract, render and replace
+// handleShortcodes does all in  one go: extract, render and replace
 // only used for testing
-func ShortcodesHandle(stringToParse string, page *Page, t tpl.Template) string {
+func handleShortcodes(stringToParse string, page *Page, t tpl.Template) string {
 	tmpContent, tmpShortcodes := extractAndRenderShortcodes(stringToParse, page, t)
 
 	if len(tmpShortcodes) > 0 {
@@ -171,7 +171,7 @@ const innerCleanupExpand = "$1"
 
 func renderShortcode(sc shortcode, p *Page, t tpl.Template) string {
 	var data = &ShortcodeWithPage{Params: sc.params, Page: p}
-	tmpl := GetTemplate(sc.name, t)
+	tmpl := getShortcodeTemplate(sc.name, t)
 
 	if tmpl == nil {
 		jww.ERROR.Printf("Unable to locate template for shortcode '%s' in page %s", sc.name, p.BaseFileName())
@@ -229,7 +229,7 @@ func renderShortcode(sc shortcode, p *Page, t tpl.Template) string {
 
 	}
 
-	return ShortcodeRender(tmpl, data)
+	return renderShortcodeWithPage(tmpl, data)
 }
 
 func extractAndRenderShortcodes(stringToParse string, p *Page, t tpl.Template) (string, map[string]string) {
@@ -320,7 +320,7 @@ Loop:
 			sc.inner = append(sc.inner, currItem.val)
 		case tScName:
 			sc.name = currItem.val
-			tmpl := GetTemplate(sc.name, t)
+			tmpl := getShortcodeTemplate(sc.name, t)
 
 			if tmpl == nil {
 				return sc, fmt.Errorf("Unable to locate template for shortcode '%s' in page %s", sc.name, p.BaseFileName())
@@ -481,7 +481,7 @@ func replaceShortcodeTokens(source []byte, prefix string, wrapped bool, replacem
 	return b, err
 }
 
-func GetTemplate(name string, t tpl.Template) *template.Template {
+func getShortcodeTemplate(name string, t tpl.Template) *template.Template {
 	if x := t.Lookup("shortcodes/" + name + ".html"); x != nil {
 		return x
 	}
@@ -491,7 +491,7 @@ func GetTemplate(name string, t tpl.Template) *template.Template {
 	return t.Lookup("_internal/shortcodes/" + name + ".html")
 }
 
-func ShortcodeRender(tmpl *template.Template, data *ShortcodeWithPage) string {
+func renderShortcodeWithPage(tmpl *template.Template, data *ShortcodeWithPage) string {
 	buffer := bp.GetBuffer()
 	defer bp.PutBuffer(buffer)
 
diff --git a/hugolib/shortcode_test.go b/hugolib/shortcode_test.go
@@ -20,7 +20,7 @@ func pageFromString(in, filename string) (*Page, error) {
 func CheckShortCodeMatch(t *testing.T, input, expected string, template tpl.Template) {
 
 	p, _ := pageFromString(SIMPLE_PAGE, "simple.md")
-	output := ShortcodesHandle(input, p, template)
+	output := handleShortcodes(input, p, template)
 
 	if output != expected {
 		t.Fatalf("Shortcode render didn't match. Expected: %q, Got: %q", expected, output)