aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
author无闻 <joe2010xtmf@163.com>2014-04-10 14:38:48 -0400
committer无闻 <joe2010xtmf@163.com>2014-04-10 14:38:48 -0400
commit8faa0dbcd77ec17bbf88041f46e2fc48f6ca6f31 (patch)
tree3dff34e53f34632532fd7a05e00e6f06b3e7fb82 /modules
parent2577940c30f6a6d15390974ab36f8c3d1e00f9f4 (diff)
parenta4cbe79567072befd96cf1b7eb319de1e2809ca3 (diff)
Merge pull request #70 from zhsso/git
Git
Diffstat (limited to 'modules')
-rw-r--r--modules/base/conf.go1
-rw-r--r--modules/base/markdown.go6
-rw-r--r--modules/base/template.go3
-rw-r--r--modules/middleware/render.go2
-rw-r--r--modules/oauth2/oauth2.go15
5 files changed, 11 insertions, 16 deletions
diff --git a/modules/base/conf.go b/modules/base/conf.go
index 69df49dc..871595e4 100644
--- a/modules/base/conf.go
+++ b/modules/base/conf.go
@@ -43,6 +43,7 @@ var (
AppName string
AppLogo string
AppUrl string
+ IsProdMode bool
Domain string
SecretKey string
RunUser string
diff --git a/modules/base/markdown.go b/modules/base/markdown.go
index 1893ccee..cc180775 100644
--- a/modules/base/markdown.go
+++ b/modules/base/markdown.go
@@ -133,14 +133,14 @@ func RenderSpecialLink(rawBytes []byte, urlPrefix string) []byte {
}
func RenderMarkdown(rawBytes []byte, urlPrefix string) []byte {
- // body := RenderSpecialLink(rawBytes, urlPrefix)
+ body := RenderSpecialLink(rawBytes, urlPrefix)
// fmt.Println(string(body))
htmlFlags := 0
// htmlFlags |= gfm.HTML_USE_XHTML
// htmlFlags |= gfm.HTML_USE_SMARTYPANTS
// htmlFlags |= gfm.HTML_SMARTYPANTS_FRACTIONS
// htmlFlags |= gfm.HTML_SMARTYPANTS_LATEX_DASHES
- htmlFlags |= gfm.HTML_SKIP_HTML
+ // htmlFlags |= gfm.HTML_SKIP_HTML
htmlFlags |= gfm.HTML_SKIP_STYLE
htmlFlags |= gfm.HTML_SKIP_SCRIPT
htmlFlags |= gfm.HTML_GITHUB_BLOCKCODE
@@ -162,7 +162,7 @@ func RenderMarkdown(rawBytes []byte, urlPrefix string) []byte {
extensions |= gfm.EXTENSION_SPACE_HEADERS
extensions |= gfm.EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK
- body := gfm.Markdown(rawBytes, renderer, extensions)
+ body = gfm.Markdown(body, renderer, extensions)
// fmt.Println(string(body))
return body
}
diff --git a/modules/base/template.go b/modules/base/template.go
index 6cd8ade6..5a42107c 100644
--- a/modules/base/template.go
+++ b/modules/base/template.go
@@ -56,6 +56,9 @@ var TemplateFuncs template.FuncMap = map[string]interface{}{
"AppDomain": func() string {
return Domain
},
+ "IsProdMode": func() bool {
+ return IsProdMode
+ },
"LoadTimes": func(startTime time.Time) string {
return fmt.Sprint(time.Since(startTime).Nanoseconds()/1e6) + "ms"
},
diff --git a/modules/middleware/render.go b/modules/middleware/render.go
index 98d485af..66289988 100644
--- a/modules/middleware/render.go
+++ b/modules/middleware/render.go
@@ -146,7 +146,7 @@ func compile(options RenderOptions) *template.Template {
tmpl := t.New(filepath.ToSlash(name))
for _, funcs := range options.Funcs {
- tmpl.Funcs(funcs)
+ tmpl = tmpl.Funcs(funcs)
}
template.Must(tmpl.Funcs(helperFuncs).Parse(string(buf)))
diff --git a/modules/oauth2/oauth2.go b/modules/oauth2/oauth2.go
index 180c52ca..05ae4606 100644
--- a/modules/oauth2/oauth2.go
+++ b/modules/oauth2/oauth2.go
@@ -1,16 +1,7 @@
// Copyright 2014 Google Inc. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
+// Copyright 2014 The Gogs Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
// Package oauth2 contains Martini handlers to provide
// user login via an OAuth 2.0 backend.