From b1886d52f4fc462edb5bdc5c18ff8cdcc3546eb8 Mon Sep 17 00:00:00 2001 From: Pacien Date: Wed, 10 Jul 2013 23:52:21 +0200 Subject: Optimize contextual variables generation --- common.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'common.go') diff --git a/common.go b/common.go index 1a78017..9985aaa 100644 --- a/common.go +++ b/common.go @@ -98,10 +98,12 @@ func compile(dirPath string, elements map[string][]byte, sourceDir, outputDir, s } } + pagePath := strings.TrimPrefix(dirPath, sourceDir) + template := merge(elements) - page := mustache.Render(string(template), makeContext(dirPath, sourceDir, outputDir, exts)) + page := mustache.Render(string(template), makeContext(pagePath, sourceDir, exts)) - err := fcmd.WriteFile(path.Join(outputDir, strings.TrimPrefix(dirPath, sourceDir), saveAs), []byte(page)) + err := fcmd.WriteFile(path.Join(outputDir, pagePath, saveAs), []byte(page)) if err != nil { fmt.Println(err) return -- cgit v1.2.3