From d71a8fece853911fb4702e43447da6fffd52941b Mon Sep 17 00:00:00 2001 From: Unknwon Date: Wed, 17 May 2017 18:50:14 -0400 Subject: feature/org-mode: fix compile error --- gogs.go | 2 +- modules/markup/orgmode.go | 35 ----------------------------------- pkg/markup/orgmode.go | 35 +++++++++++++++++++++++++++++++++++ routers/repo/view.go | 8 ++++---- templates/.VERSION | 2 +- 5 files changed, 41 insertions(+), 41 deletions(-) delete mode 100644 modules/markup/orgmode.go create mode 100644 pkg/markup/orgmode.go diff --git a/gogs.go b/gogs.go index 36044740..61da6456 100644 --- a/gogs.go +++ b/gogs.go @@ -16,7 +16,7 @@ import ( "github.com/gogits/gogs/pkg/setting" ) -const APP_VER = "0.11.9.0407" +const APP_VER = "0.11.10.0517" func init() { setting.AppVer = APP_VER diff --git a/modules/markup/orgmode.go b/modules/markup/orgmode.go deleted file mode 100644 index c7f62f50..00000000 --- a/modules/markup/orgmode.go +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2017 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 markup - -import ( - "path/filepath" - "strings" - - "github.com/chaseadamsio/goorgeous" -) - -var orgModeExtensions = []string{".org"} - -// IsOrgModeFile reports whether name looks like a Org-mode file based on its extension. -func IsOrgModeFile(name string) bool { - extension := strings.ToLower(filepath.Ext(name)) - for _, ext := range orgModeExtensions { - if strings.ToLower(ext) == extension { - return true - } - } - return false -} - -// RawOrgMode renders content in Org-mode syntax to HTML without handling special links. -func RawOrgMode(body []byte, urlPrefix string) []byte { - return goorgeous.OrgCommon(body) -} - -// OrgMode takes a string or []byte and renders to HTML in Org-mode syntax with special links. -func OrgMode(input interface{}, urlPrefix string, metas map[string]string) []byte { - return Render(ORG_MODE, input, urlPrefix, metas) -} diff --git a/pkg/markup/orgmode.go b/pkg/markup/orgmode.go new file mode 100644 index 00000000..c7f62f50 --- /dev/null +++ b/pkg/markup/orgmode.go @@ -0,0 +1,35 @@ +// Copyright 2017 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 markup + +import ( + "path/filepath" + "strings" + + "github.com/chaseadamsio/goorgeous" +) + +var orgModeExtensions = []string{".org"} + +// IsOrgModeFile reports whether name looks like a Org-mode file based on its extension. +func IsOrgModeFile(name string) bool { + extension := strings.ToLower(filepath.Ext(name)) + for _, ext := range orgModeExtensions { + if strings.ToLower(ext) == extension { + return true + } + } + return false +} + +// RawOrgMode renders content in Org-mode syntax to HTML without handling special links. +func RawOrgMode(body []byte, urlPrefix string) []byte { + return goorgeous.OrgCommon(body) +} + +// OrgMode takes a string or []byte and renders to HTML in Org-mode syntax with special links. +func OrgMode(input interface{}, urlPrefix string, metas map[string]string) []byte { + return Render(ORG_MODE, input, urlPrefix, metas) +} diff --git a/routers/repo/view.go b/routers/repo/view.go index 024268ba..b4b4e386 100644 --- a/routers/repo/view.go +++ b/routers/repo/view.go @@ -88,11 +88,11 @@ func renderDirectory(c *context.Context, treeLink string) { switch markup.Detect(readmeFile.Name()) { case markup.MARKDOWN: - ctx.Data["IsMarkdown"] = true - buf = markup.Markdown(buf, treeLink, ctx.Repo.Repository.ComposeMetas()) + c.Data["IsMarkdown"] = true + buf = markup.Markdown(buf, treeLink, c.Repo.Repository.ComposeMetas()) case markup.ORG_MODE: - ctx.Data["IsMarkdown"] = true - buf = markup.OrgMode(buf, treeLink, ctx.Repo.Repository.ComposeMetas()) + c.Data["IsMarkdown"] = true + buf = markup.OrgMode(buf, treeLink, c.Repo.Repository.ComposeMetas()) case markup.IPYTHON_NOTEBOOK: c.Data["IsIPythonNotebook"] = true c.Data["RawFileLink"] = c.Repo.RepoLink + "/raw/" + path.Join(c.Repo.BranchName, c.Repo.TreePath, readmeFile.Name()) diff --git a/templates/.VERSION b/templates/.VERSION index fa791cf6..48f12621 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.11.9.0407 \ No newline at end of file +0.11.10.0517 \ No newline at end of file -- cgit v1.2.3