diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2017-09-21 13:20:14 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-21 13:20:14 +0800 |
commit | 0d80af649a50c4b9e5e4ba764399872fc92f70f2 (patch) | |
tree | f09f289260005bc6913119643230c08c81dfab49 /routers/repo/view.go | |
parent | 66bc0ac251f564491ed0a6d5d4cfa0a11af09303 (diff) | |
download | gitea-0d80af649a50c4b9e5e4ba764399872fc92f70f2.tar.gz gitea-0d80af649a50c4b9e5e4ba764399872fc92f70f2.zip |
Add init support of orgmode document type on file view and readme (#2525)
* add init support of orgmode document type on file view and readme
* fix imports
* fix imports and readmeExist
* fix imports order
* fix format
* remove unnecessary convert
Diffstat (limited to 'routers/repo/view.go')
-rw-r--r-- | routers/repo/view.go | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/routers/repo/view.go b/routers/repo/view.go index d794a57405..bfba7acac8 100644 --- a/routers/repo/view.go +++ b/routers/repo/view.go @@ -95,11 +95,11 @@ func renderDirectory(ctx *context.Context, treeLink string) { buf = append(buf, d...) newbuf := markup.Render(readmeFile.Name(), buf, treeLink, ctx.Repo.Repository.ComposeMetas()) if newbuf != nil { - ctx.Data["IsMarkdown"] = true + ctx.Data["IsMarkup"] = true } else { // FIXME This is the only way to show non-markdown files // instead of a broken "View Raw" link - ctx.Data["IsMarkdown"] = true + ctx.Data["IsMarkup"] = false newbuf = bytes.Replace(buf, []byte("\n"), []byte(`<br>`), -1) } ctx.Data["FileContent"] = string(newbuf) @@ -197,10 +197,8 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st tp := markup.Type(blob.Name()) isSupportedMarkup := tp != "" - // FIXME: currently set IsMarkdown for compatible - ctx.Data["IsMarkdown"] = isSupportedMarkup - - readmeExist := isSupportedMarkup || markup.IsReadmeFile(blob.Name()) + ctx.Data["IsMarkup"] = isSupportedMarkup + readmeExist := markup.IsReadmeFile(blob.Name()) ctx.Data["ReadmeExist"] = readmeExist if readmeExist && isSupportedMarkup { ctx.Data["FileContent"] = string(markup.Render(blob.Name(), buf, path.Dir(treeLink), ctx.Repo.Repository.ComposeMetas())) |