mirror of
https://github.com/gogs/gogs.git
synced 2025-05-24 08:22:34 +00:00
* Added deletion of an empty line at the end of file (#5261) Signed-off-by: Alexey Terentyev <axifnx@gmail.com> * Fix after feedback Signed-off-by: Alexey Terentyev <axifnx@gmail.com>
This commit is contained in:
parent
91441c3fb2
commit
4c844081f3
@ -185,6 +185,10 @@ func renderFile(c *context.Context, entry *git.TreeEntry, treeLink, rawLink stri
|
||||
|
||||
var output bytes.Buffer
|
||||
lines := strings.Split(fileContent, "\n")
|
||||
// Remove blank line at the end of file
|
||||
if len(lines) > 0 && len(lines[len(lines)-1])==0 {
|
||||
lines = lines[:len(lines)-1]
|
||||
}
|
||||
for index, line := range lines {
|
||||
output.WriteString(fmt.Sprintf(`<li class="L%d" rel="L%d">%s</li>`, index+1, index+1, gotemplate.HTMLEscapeString(strings.TrimRight(line, "\r"))) + "\n")
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user