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:
parent
7d50c644e5
commit
9571592de0
9
page.go
9
page.go
@ -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()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user