Get the date from the TOML posts too.
This commit is contained in:
parent
523b36d823
commit
441bc58cf8
|
@ -20,7 +20,8 @@ defmodule JOL.Blog.Parser do
|
||||||
parsed_attrs = %{
|
parsed_attrs = %{
|
||||||
title: toml_attrs["title"],
|
title: toml_attrs["title"],
|
||||||
draft: toml_attrs["draft"],
|
draft: toml_attrs["draft"],
|
||||||
tags: toml_attrs["taxonomies"]["tags"]
|
tags: toml_attrs["taxonomies"]["tags"],
|
||||||
|
date: toml_attrs["date"]
|
||||||
}
|
}
|
||||||
|
|
||||||
parsed_body = String.trim(body)
|
parsed_body = String.trim(body)
|
||||||
|
|
|
@ -37,8 +37,8 @@ defmodule JOL.Blog.ParserTest do
|
||||||
assert post.attrs.draft == false
|
assert post.attrs.draft == false
|
||||||
end
|
end
|
||||||
|
|
||||||
test "parses the attrs from zola-style posts", post do
|
test "parses the publish date from zola-style posts", post do
|
||||||
{attrs, _body} = Parser.parse("filepath", post.content)
|
{:ok, known_date, _} = DateTime.from_iso8601("2024-01-02 14:00:00-05:00")
|
||||||
assert attrs == %{title: "test post", draft: false, tags: ["howto", "hardware"]}
|
assert Date.compare(known_date, post.attrs.date) == :eq
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue