1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00

Trim whitespace at bottom of entry

This commit is contained in:
Zack Scholl 2017-04-11 07:53:59 -06:00
parent 7d50c644e5
commit 9571592de0

View File

@ -60,9 +60,18 @@ func DecodeFileName(s string) string {
return s2 return s2
} }
// Update cleans the text and updates the versioned text
// and generates a new render
func (p *Page) Update(newText string) error { func (p *Page) Update(newText string) error {
// Trim space from end
newText = strings.TrimRight(newText, "\n\t ")
// Update the versioned text
p.Text.Update(newText) p.Text.Update(newText)
// Render the new page
p.Render() p.Render()
return p.Save() return p.Save()
} }