Added try statement

This commit is contained in:
vanten-s 2023-08-05 10:38:54 +02:00
parent 73cc349405
commit f05be8dca2
Signed by: vanten-s
GPG key ID: DE3060396884D3F2

View file

@ -17,8 +17,13 @@ def convert_case(string: str):
return string return string
def article_to_xml(article_path: pathlib.Path): def article_to_xml(article_path: pathlib.Path):
with (article_path / "article.md").open("r") as f: try:
markdown_data = f.read() with (article_path / "article.md").open("r") as f:
markdown_data = f.read()
except Exception as e:
print(e)
return
markdown_instance = markdown.Markdown(extensions=['meta', 'nl2br']) markdown_instance = markdown.Markdown(extensions=['meta', 'nl2br'])
html = markdown_instance.convert(markdown_data) html = markdown_instance.convert(markdown_data)