diff --git a/routers/repo/view.go b/routers/repo/view.go index 2b1665201..11e12186b 100644 --- a/routers/repo/view.go +++ b/routers/repo/view.go @@ -185,6 +185,7 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st output.WriteString(fmt.Sprintf(`%d`, i+1, i+1)) } ctx.Data["LineNums"] = gotemplate.HTML(output.String()) + ctx.Data["LineCount"] = len(lines) } if canEnableEditor { diff --git a/templates/repo/view_file.tmpl b/templates/repo/view_file.tmpl index fe68b7cb6..e2449e431 100644 --- a/templates/repo/view_file.tmpl +++ b/templates/repo/view_file.tmpl @@ -5,11 +5,22 @@ {{if .ReadmeInList}} {{.FileName}} {{else}} - {{.FileName}} {{FileSize .FileSize}} + {{end}} {{else}} - - {{.FileName}} {{FileSize .FileSize}} + {{end}} {{if not .ReadmeInList}}