1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
import datetime
from skaldpress.metadata_parser import extract_parse_yaml_metadata
res = extract_parse_yaml_metadata("""---
title: Example-article
target_filename: example-article
template: article.html
publish_date: 2025-01-01T00:00:00Z
summary: A short example article
num: 2
tags:
- article
---
Article content
""")
meta = {
"title": "Example-article",
"target_filename": "example-article",
"template": "article.html",
"publish_date": datetime.datetime(2025, 1, 1, 0, 0, tzinfo=datetime.timezone.utc),
"change_date": datetime.datetime(2025, 1, 1, 0, 0, tzinfo=datetime.timezone.utc),
"summary": "A short example article",
"num": 2,
"tags": ["article"]
}
assert res[0] == meta
assert res[1] == "Article content\n"
|