mirror of
https://github.com/go-gitea/gitea
synced 2024-11-25 08:42:48 +01:00
Merge branch 'master' into add-api-issues-subscriptions
This commit is contained in:
commit
2de729046b
2 changed files with 6 additions and 1 deletions
|
@ -307,6 +307,11 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st
|
||||||
var output bytes.Buffer
|
var output bytes.Buffer
|
||||||
lines := strings.Split(fileContent, "\n")
|
lines := strings.Split(fileContent, "\n")
|
||||||
ctx.Data["NumLines"] = len(lines)
|
ctx.Data["NumLines"] = len(lines)
|
||||||
|
if len(lines) == 1 && lines[0] == "" {
|
||||||
|
// If the file is completely empty, we show zero lines at the line counter
|
||||||
|
ctx.Data["NumLines"] = 0
|
||||||
|
}
|
||||||
|
ctx.Data["NumLinesSet"] = true
|
||||||
|
|
||||||
//Remove blank line at the end of file
|
//Remove blank line at the end of file
|
||||||
if len(lines) > 0 && lines[len(lines)-1] == "" {
|
if len(lines) > 0 && lines[len(lines)-1] == "" {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<strong>{{.FileName}}</strong>
|
<strong>{{.FileName}}</strong>
|
||||||
{{else}}
|
{{else}}
|
||||||
<div class="file-info text grey normal mono">
|
<div class="file-info text grey normal mono">
|
||||||
{{if .NumLines}}
|
{{if .NumLinesSet}}
|
||||||
<div class="file-info-entry">
|
<div class="file-info-entry">
|
||||||
{{.NumLines}} {{.i18n.Tr (TrN .i18n.Lang .NumLines "repo.line" "repo.lines") }}
|
{{.NumLines}} {{.i18n.Tr (TrN .i18n.Lang .NumLines "repo.line" "repo.lines") }}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue