diff --git a/model/post.go b/model/post.go index b4af035..bd8e8ee 100644 --- a/model/post.go +++ b/model/post.go @@ -32,7 +32,7 @@ const ( ) var ( - rPostDecoder = regexp.MustCompile(`^(?ms:\n*\n{2,}# +(.*?)\n+(.*))$`) + rPostDecoder = regexp.MustCompile(`^(?ms:\n*\n{2,}# +(.*?)\n+(.*))$`) tmpl = func() (t *template.Template) { t = template.New("postfile") template.Must(t.Parse(postTemplate)) diff --git a/model/post_test.go b/model/post_test.go index 29f20b5..11e719d 100644 --- a/model/post_test.go +++ b/model/post_test.go @@ -1733,6 +1733,37 @@ Paragraph } } +func TestPostDecodeWithMultiComment(t *testing.T) { + testutil.CleanUp() + defer testutil.CleanUp() + + var post model.Post + err := post.Decode([]byte(` + +# Example Title + + + +# This is not title of this post +`)) + if err != nil { + t.Fatal(err) + } +} + func TestPostDecodeWithWrongTag(t *testing.T) { testutil.CleanUp() defer testutil.CleanUp() @@ -1765,7 +1796,7 @@ Paragraph } } -func TestDecodeWithWrongTitle(t *testing.T) { +func TestPostDecodeWithWrongTitle(t *testing.T) { testutil.CleanUp() defer testutil.CleanUp()