2024-05-21 16:52:37 +00:00
|
|
|
defmodule JOL.Blog.Parser do
|
2024-05-21 16:43:36 +00:00
|
|
|
# Parses blog posts.
|
|
|
|
def parse(_path, content) do
|
|
|
|
%{"attrs" => attrs, "body" => body} =
|
|
|
|
Regex.named_captures(~r/\+\+\+\n(?<attrs>.*)\n\+\+\+\n\n(?<body>.*)/s, content)
|
|
|
|
|
2024-05-21 16:47:06 +00:00
|
|
|
{attrs, String.trim(body)}
|
2024-05-21 16:43:36 +00:00
|
|
|
end
|
|
|
|
end
|