shithub: hugo

Download patch

ref: a0447345418e735a4b0fd401c1610950f66ed778
parent: 32bf8b763c647cac81decf0470824317fc31f8fc
author: quoha <[email protected]>
date: Sun Mar 15 16:56:20 EDT 2015

Add "getenv" as an wrapper for os.Getenv

Add a wrapper for the os.Getenv function. The
wrapper takes as input a string that is assumed to be an exported
variable name.

Fixes #977

--- a/tpl/template.go
+++ b/tpl/template.go
@@ -1341,6 +1341,7 @@
 		"getCSV":      GetCSV,
 		"getCsv":      GetCSV,
 		"seq":         helpers.Seq,
+		"getenv":      func(varName string) string { return os.Getenv(varName) },
 	}
 
 }