prevent export of empty articles
This commit is contained in:
parent
079e156971
commit
73927bd3cc
@ -40,10 +40,13 @@ for exported in range(nbToExport):
|
|||||||
print(f"\n--- {nbToExport - exported} articles remaining ---\n")
|
print(f"\n--- {nbToExport - exported} articles remaining ---\n")
|
||||||
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")
|
||||||
body = content(article.texte)
|
body = content(article.texte)
|
||||||
articleDir = "{}/{}".format(CONFIG["outputDir"], meta.get_slug())
|
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(
|
||||||
@ -54,6 +57,8 @@ for exported in range(nbToExport):
|
|||||||
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()
|
||||||
|
Loading…
Reference in New Issue
Block a user