In GetArticle() func removed unnecessary else {} nesting.
This commit is contained in:
parent
69493f50aa
commit
fbb4389065
@ -49,27 +49,27 @@ func GetArticleMetadata() (meta []ArticleMetadata) {
|
||||
|
||||
func GetArticle(name string) (*article.Article, error) {
|
||||
if artcl, ok := articles[name]; ok {
|
||||
return &artcl, nil
|
||||
} else {
|
||||
meta, err := articlesFS.ReadFile("articles/" + name + articleMetaExtension)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
md, err := articlesFS.ReadFile("articles/" + name + articleFileExtension)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
artcl := article.Article{
|
||||
Body: markdown.ToHTML(md, nil, nil)}
|
||||
|
||||
artcl.ParseMetadata(meta)
|
||||
|
||||
articles[name] = artcl
|
||||
|
||||
return &artcl, nil
|
||||
}
|
||||
|
||||
meta, err := articlesFS.ReadFile("articles/" + name + articleMetaExtension)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
md, err := articlesFS.ReadFile("articles/" + name + articleFileExtension)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
artcl := article.Article{
|
||||
Body: markdown.ToHTML(md, nil, nil)}
|
||||
|
||||
artcl.ParseMetadata(meta)
|
||||
|
||||
articles[name] = artcl
|
||||
|
||||
return &artcl, nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
Loading…
Reference in New Issue
Block a user