summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-03-19 03:24:23 -0400
committerUnknown <joe2010xtmf@163.com>2014-03-19 03:24:23 -0400
commit57db97b32ca4085e549a41480d35cee743ca3f99 (patch)
treee6fef4152ee75cf5f2629ec00f0e1768d7b7b207 /modules
parent460aa3eaa96df483981e74a6992878941f11bf00 (diff)
parent9e8e910bd64e3fd6526ead90f7211fcc1a81964d (diff)
downloadgitea-57db97b32ca4085e549a41480d35cee743ca3f99.tar.gz
gitea-57db97b32ca4085e549a41480d35cee743ca3f99.zip
Merge branch 'master' of github.com:gogits/gogs
Diffstat (limited to 'modules')
-rw-r--r--modules/base/template.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/modules/base/template.go b/modules/base/template.go
index 4517cd47aa..db79340e75 100644
--- a/modules/base/template.go
+++ b/modules/base/template.go
@@ -5,6 +5,7 @@
package base
import (
+ "container/list"
"html/template"
)
@@ -12,6 +13,23 @@ func Str2html(raw string) template.HTML {
return template.HTML(raw)
}
+func Range(l int) []int {
+ return make([]int, l)
+}
+
+func List(l *list.List) chan interface{} {
+ e := l.Front()
+ c := make(chan interface{})
+ go func() {
+ for e != nil {
+ c <- e.Value
+ e = e.Next()
+ }
+ close(c)
+ }()
+ return c
+}
+
var TemplateFuncs template.FuncMap = map[string]interface{}{
"AppName": func() string {
return AppName
@@ -30,4 +48,5 @@ var TemplateFuncs template.FuncMap = map[string]interface{}{
"ActionIcon": ActionIcon,
"ActionDesc": ActionDesc,
"DateFormat": DateFormat,
+ "List": List,
}