export empty articles

This commit is contained in:
Guilhem Fauré 2023-05-11 09:25:26 +02:00
parent a4bb234b72
commit 5e86ed0ed5

View File

@ -41,24 +41,21 @@ for exported in range(nbToExport):
article = articles[exported] article = articles[exported]
meta = metadata(article) meta = metadata(article)
if len(article.texte) > 0: print(f"{exported+1}. Exporting {meta.title}")
print(f"{exported+1}. Exporting {meta.title}") print(f" to {meta.get_slug()}/index.md")
print(f" to {meta.get_slug()}/index.md") articleDir = "{}/{}".format(CONFIG["outputDir"], meta.get_slug())
body = content(article.texte) body = content(article.texte)
articleDir = "{}/{}".format(CONFIG["outputDir"], meta.get_slug())
mkdir(articleDir) mkdir(articleDir)
with open("{}/index.md".format(articleDir), "w") as f: with open("{}/index.md".format(articleDir), "w") as f:
f.write( f.write(
"{}\n\n{}\n{}\n{}".format( "{}\n\n{}\n{}\n{}".format(
meta.get_frontmatter(), meta.get_frontmatter(),
meta.get_starting(), meta.get_starting(),
body.get_markdown(), body.get_markdown(),
meta.get_ending(), meta.get_ending(),
)
) )
else: )
print(f"{exported+1}. NOT exporting the EMPTY article {meta.title}")
# Close the database connection # Close the database connection
db.close() db.close()