Merge branch 'master' of https://github.com/astaxie/beego into form
Showing
4 changed files
with
4 additions
and
13 deletions
| ... | @@ -32,7 +32,7 @@ type FileLogWriter struct { | ... | @@ -32,7 +32,7 @@ type FileLogWriter struct { |
| 32 | 32 | ||
| 33 | rotate bool | 33 | rotate bool |
| 34 | 34 | ||
| 35 | startLock sync.Mutex //only one log can writer to the file | 35 | startLock sync.Mutex // Only one log can write to the file |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | type MuxWriter struct { | 38 | type MuxWriter struct { | ... | ... |
| ... | @@ -94,7 +94,8 @@ func (p *ControllerRegistor) Add(pattern string, c ControllerInterface, mappingM | ... | @@ -94,7 +94,8 @@ func (p *ControllerRegistor) Add(pattern string, c ControllerInterface, mappingM |
| 94 | } | 94 | } |
| 95 | } | 95 | } |
| 96 | } | 96 | } |
| 97 | t := reflect.Indirect(reflect.ValueOf(c)).Type() | 97 | reflectVal := reflect.ValueOf(c) |
| 98 | t := reflect.Indirect(reflectVal).Type() | ||
| 98 | methods := make(map[string]string) | 99 | methods := make(map[string]string) |
| 99 | if len(mappingMethods) > 0 { | 100 | if len(mappingMethods) > 0 { |
| 100 | semi := strings.Split(mappingMethods[0], ";") | 101 | semi := strings.Split(mappingMethods[0], ";") |
| ... | @@ -106,7 +107,7 @@ func (p *ControllerRegistor) Add(pattern string, c ControllerInterface, mappingM | ... | @@ -106,7 +107,7 @@ func (p *ControllerRegistor) Add(pattern string, c ControllerInterface, mappingM |
| 106 | comma := strings.Split(colon[0], ",") | 107 | comma := strings.Split(colon[0], ",") |
| 107 | for _, m := range comma { | 108 | for _, m := range comma { |
| 108 | if m == "*" || inSlice(strings.ToLower(m), HTTPMETHOD) { | 109 | if m == "*" || inSlice(strings.ToLower(m), HTTPMETHOD) { |
| 109 | if _, ok := t.MethodByName(colon[1]); ok { | 110 | if val := reflectVal.MethodByName(colon[1]); val.IsValid() { |
| 110 | methods[strings.ToLower(m)] = colon[1] | 111 | methods[strings.ToLower(m)] = colon[1] |
| 111 | } else { | 112 | } else { |
| 112 | panic(colon[1] + " method don't exist in the controller " + t.Name()) | 113 | panic(colon[1] + " method don't exist in the controller " + t.Name()) | ... | ... |
| ... | @@ -23,7 +23,6 @@ func init() { | ... | @@ -23,7 +23,6 @@ func init() { |
| 23 | beegoTplFuncMap = make(template.FuncMap) | 23 | beegoTplFuncMap = make(template.FuncMap) |
| 24 | BeeTemplateExt = make([]string, 0) | 24 | BeeTemplateExt = make([]string, 0) |
| 25 | BeeTemplateExt = append(BeeTemplateExt, "tpl", "html") | 25 | BeeTemplateExt = append(BeeTemplateExt, "tpl", "html") |
| 26 | beegoTplFuncMap["markdown"] = MarkDown | ||
| 27 | beegoTplFuncMap["dateformat"] = DateFormat | 26 | beegoTplFuncMap["dateformat"] = DateFormat |
| 28 | beegoTplFuncMap["date"] = Date | 27 | beegoTplFuncMap["date"] = Date |
| 29 | beegoTplFuncMap["compare"] = Compare | 28 | beegoTplFuncMap["compare"] = Compare | ... | ... |
| ... | @@ -2,7 +2,6 @@ package beego | ... | @@ -2,7 +2,6 @@ package beego |
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "fmt" | 4 | "fmt" |
| 5 | "github.com/russross/blackfriday" | ||
| 6 | "html/template" | 5 | "html/template" |
| 7 | "net/url" | 6 | "net/url" |
| 8 | "reflect" | 7 | "reflect" |
| ... | @@ -20,14 +19,6 @@ func webTime(t time.Time) string { | ... | @@ -20,14 +19,6 @@ func webTime(t time.Time) string { |
| 20 | return ftime | 19 | return ftime |
| 21 | } | 20 | } |
| 22 | 21 | ||
| 23 | // MarkDown parses a string in MarkDown format and returns HTML. Used by the template parser as "markdown" | ||
| 24 | func MarkDown(raw string) (output template.HTML) { | ||
| 25 | input := []byte(raw) | ||
| 26 | bOutput := blackfriday.MarkdownBasic(input) | ||
| 27 | output = template.HTML(string(bOutput)) | ||
| 28 | return | ||
| 29 | } | ||
| 30 | |||
| 31 | func Substr(s string, start, length int) string { | 22 | func Substr(s string, start, length int) string { |
| 32 | bt := []rune(s) | 23 | bt := []rune(s) |
| 33 | if start < 0 { | 24 | if start < 0 { | ... | ... |
-
Please register or sign in to post a comment