aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2014-04-10 22:22:18 +0800
committerLunny Xiao <xiaolunwen@gmail.com>2014-04-10 22:22:18 +0800
commit88d873c67f2940325a2a7a8aa851372c9afb983d (patch)
tree53908c92ebc0dbce9ae935b72eb4b959d55a587c /modules
parent94c7278194694fec728b518d4390b03ba6c237a4 (diff)
parent6b30d9b0f27a8cb0961d52980a8e655d9a0bbda2 (diff)
Merge branch 'dev' of github.com:gogits/gogs into dev
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.