also ensure a blank line at the end of file

This commit is contained in:
dousha 2024-12-28 11:09:12 +08:00
parent c33d90547a
commit 42fd528b22
2 changed files with 2 additions and 2 deletions

2
.gitignore vendored
View File

@ -1,3 +1,3 @@
/venv/ /venv/
/output/ /output/
*.xml

View File

@ -42,7 +42,7 @@ for item in items:
content = re.sub(r'<!-- \/?wp:.+?\s*-->', '', content) content = re.sub(r'<!-- \/?wp:.+?\s*-->', '', content)
content = re.sub(r'<!--more-->', '<p class="more">:::more:::</p>', content) content = re.sub(r'<!--more-->', '<p class="more">:::more:::</p>', content)
content = '\n'.join([s.strip() for s in content.splitlines() if s.strip()]) content = '\n'.join([s.strip() for s in content.splitlines() if s.strip()])
content = md(content).strip() content = md(content).strip() + '\n'
frontmatter = f"---\nlayout: {post_type}\nid: {post_id}\ntitle: \"{title}\"\ncreator: \"{creator}\"\ndate: {date}\ncategories:\n{categories}\ntags:\n{tags}\ndraft: {'yes' if status == 'draft' else 'no'}\n---\n\n" frontmatter = f"---\nlayout: {post_type}\nid: {post_id}\ntitle: \"{title}\"\ncreator: \"{creator}\"\ndate: {date}\ncategories:\n{categories}\ntags:\n{tags}\ndraft: {'yes' if status == 'draft' else 'no'}\n---\n\n"
title_slug = slugify(title) title_slug = slugify(title)