lonekorean / wordpress-export-to-markdown

Converts a WordPress export XML file into Markdown files.
MIT License
1.07k stars 216 forks source link

Fix pub date being incorrectly encoded as string in frontmatter #122

Open onvlt opened 2 months ago

onvlt commented 2 months ago

This PR changes how datetimes are encoded in frontmatter. In current version, they're encoded as strings (enclosed in quotes). After this change encodes datetimes to YAML timestamps (without quotes).

ie. current behavior:

---
date: "2022-10-28"
---

new result:

---
date: 2022-10-28
---

This is done by moving pub date encoding logic from parser to writer. Parser now keeps datetime as luxon.DateTime type and writer takes responsibility for converting this to string, deciding upon frontmatter value type and settings.