diff --git a/cethttp/editor.go b/cethttp/editor.go
index 1ff19c4..7c3f02b 100644
--- a/cethttp/editor.go
+++ b/cethttp/editor.go
@@ -71,7 +71,7 @@ const editorTemplate = `
-
+
@@ -85,6 +85,16 @@ const editorTemplate = `
`
func editorHtml5Page(post *database.Post) string {
+ if post.GemtextContent.Valid {
+ if strings.HasPrefix(post.GemtextContent.String, "{") {
+ post.GemtextContent.String = strings.TrimPrefix(post.GemtextContent.String, "{")
+ }
+ if strings.HasSuffix(post.GemtextContent.String, "true}") {
+ post.GemtextContent.String = strings.TrimSuffix(post.GemtextContent.String, "true}")
+ }
+ } else {
+ post.GemtextContent.String = ""
+ }
t1 := template.New("editorHtml5Page")
t1, _ = t1.Parse(editorTemplate)
result := new(strings.Builder)
diff --git a/database/post.go b/database/post.go
index 90cecba..05941e0 100644
--- a/database/post.go
+++ b/database/post.go
@@ -27,14 +27,6 @@ func (p *Post) HTMLPage() string {
var content string
if p.GemtextContent.Valid {
content = p.GemtextContent.String
- if strings.HasPrefix(content, "{") {
- content = strings.TrimPrefix(content, "{")
- }
- if strings.HasSuffix(content, "true}") {
- content = strings.TrimSuffix(content, "true}")
- }
- } else {
- content = ""
}
lines := strings.Split(content, "\n")
@@ -61,6 +53,7 @@ func (p *Post) HTMLPage() string {
url := parts[0]
htmlLines = append(htmlLines, fmt.Sprintf(`%s`, url, url))
}
+
} else {
htmlLines = append(htmlLines, ""+line+"
")
}