remove special characters from the titles

This commit is contained in:
Andreas Zweili 2020-11-09 12:43:52 +01:00
parent 1d7f12b370
commit c6c9d6a415
1 changed files with 10 additions and 1 deletions

View File

@ -2,9 +2,18 @@ import os.path
import markdownify
def _clean_title(raw_title):
title = str(raw_title)
bad_characters = ['«', '»', ',', '.', "'", "`",
"?", "", "{", "}", "(", ")", "[", "]", "!", "$"]
for character in bad_characters:
title = title.replace(character, '')
return title
def _build_path(title):
ressources_folder = "~/03_documents/ressources/articles/"
base_filename = str(title)
base_filename = _clean_title(title)
short_path = os.path.join(ressources_folder, base_filename + ".md")
return os.path.expanduser(short_path)