remove special characters from the titles
This commit is contained in:
parent
1d7f12b370
commit
c6c9d6a415
|
@ -2,9 +2,18 @@ import os.path
|
||||||
import markdownify
|
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):
|
def _build_path(title):
|
||||||
ressources_folder = "~/03_documents/ressources/articles/"
|
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")
|
short_path = os.path.join(ressources_folder, base_filename + ".md")
|
||||||
return os.path.expanduser(short_path)
|
return os.path.expanduser(short_path)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue