diff --git a/pkg/article/article.go b/pkg/article/article.go index a22fb0d..9dc6bbd 100644 --- a/pkg/article/article.go +++ b/pkg/article/article.go @@ -15,6 +15,12 @@ type Article struct { Body []byte } +func New(body, meta []byte) (article *Article, err error) { + article = &Article{Body: body} + err = article.ParseMetadata(meta) + return +} + func (artcl *Article) ParseMetadata(data []byte) error { lines := bytes.Split(data, []byte{'\n'}) if len(lines) != 4 {