diff --git a/makesite.py b/makesite.py index 2398f6a..fe12c22 100755 --- a/makesite.py +++ b/makesite.py @@ -87,7 +87,7 @@ def log(msg, *args): def truncate(text, words=25): """Remove tags and truncate text to the specified number of words.""" - return " ".join(re.sub("(?s)<.*?>", " ", text).split()[:words]) + return " ".join(re.sub(r"(?s)<.*?>", " ", text).split()[:words]) def read_headers(text): @@ -113,8 +113,8 @@ def slugify(value): value = ( unicodedata.normalize("NFKD", value).encode("ascii", "ignore").decode("ascii") ) - value = re.sub("[^\w\s-]", "", value).strip().lower() - return re.sub("[-\s]+", "-", value) + value = re.sub(r"[^\w\s-]", "", value).strip().lower() + return re.sub(r"[-\s]+", "-", value) def read_content(filename, params): @@ -173,8 +173,8 @@ def clean_html_tag(text): """Remove HTML tags.""" while True: original_text = text - text = re.sub("<\w+.*?>", "", text) - text = re.sub("<\/\w+>", "", text) + text = re.sub(r"<\w+.*?>", "", text) + text = re.sub(r"<\/\w+>", "", text) if original_text == text: break return text