aboutsummaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorJonas Franz <info@jonasfranz.software>2017-10-17 01:17:22 +0200
committerLauris BH <lauris@nix.lv>2017-10-17 02:17:22 +0300
commitf4190f8df869ce3031b705089fc9340c8d1862aa (patch)
tree1df74fa930cc3c2f090d9e4cebc48e7076920c84 /routers
parent33647aa43bc7e55f1c4c3f47caa6ecff9a738bfe (diff)
downloadgitea-f4190f8df869ce3031b705089fc9340c8d1862aa.tar.gz
gitea-f4190f8df869ce3031b705089fc9340c8d1862aa.zip
Render plain text README.txt monospaced (#2721)
Signed-off-by: Jonas Franz <info@jonasfranz.software>
Diffstat (limited to 'routers')
-rw-r--r--routers/repo/view.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/routers/repo/view.go b/routers/repo/view.go
index e8e1bacc4e..38260d2bec 100644
--- a/routers/repo/view.go
+++ b/routers/repo/view.go
@@ -93,10 +93,11 @@ func renderDirectory(ctx *context.Context, treeLink string) {
if isTextFile {
d, _ := ioutil.ReadAll(dataRc)
buf = append(buf, d...)
- ctx.Data["IsRenderedHTML"] = true
if markup.Type(readmeFile.Name()) != "" {
+ ctx.Data["IsMarkup"] = true
ctx.Data["FileContent"] = string(markup.Render(readmeFile.Name(), buf, treeLink, ctx.Repo.Repository.ComposeMetas()))
} else {
+ ctx.Data["IsRenderedHTML"] = true
ctx.Data["FileContent"] = string(bytes.Replace(buf, []byte("\n"), []byte(`<br>`), -1))
}
}
@@ -194,7 +195,7 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st
readmeExist := markup.IsReadmeFile(blob.Name())
ctx.Data["ReadmeExist"] = readmeExist
if markup.Type(blob.Name()) != "" {
- ctx.Data["IsRenderedHTML"] = true
+ ctx.Data["IsMarkup"] = true
ctx.Data["FileContent"] = string(markup.Render(blob.Name(), buf, path.Dir(treeLink), ctx.Repo.Repository.ComposeMetas()))
} else if readmeExist {
ctx.Data["IsRenderedHTML"] = true