Escape sequences

This commit is contained in:
Stavros Korokithakis 2021-11-20 17:29:56 +02:00
parent 0f91704180
commit 8770c691e6
No known key found for this signature in database
GPG Key ID: 26EA345ECD4C2A63

View File

@ -2,7 +2,6 @@
"""
Rename files like `foo/bar.html` to `foo/bar/index.html` for prettier URLs.
"""
import os
import re
import sys
from pathlib import Path
@ -20,7 +19,7 @@ def replace_links(path: Path, replacements: Dict[str, str]):
# Convert absolute links to relative.
contents = re.sub(
'((?:href|src|root)\s*=\s*")((?:\.\./)+)([^\.])', r"\1/\3", contents
r'((?:href|src|root)\s*=\s*")((?:\.\./)+)([^\.])', r"\1/\3", contents
)
f.write(contents)