Escape sequences
This commit is contained in:
parent
0f91704180
commit
8770c691e6
@ -2,7 +2,6 @@
|
|||||||
"""
|
"""
|
||||||
Rename files like `foo/bar.html` to `foo/bar/index.html` for prettier URLs.
|
Rename files like `foo/bar.html` to `foo/bar/index.html` for prettier URLs.
|
||||||
"""
|
"""
|
||||||
import os
|
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@ -20,7 +19,7 @@ def replace_links(path: Path, replacements: Dict[str, str]):
|
|||||||
|
|
||||||
# Convert absolute links to relative.
|
# Convert absolute links to relative.
|
||||||
contents = re.sub(
|
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)
|
f.write(contents)
|
||||||
|
Loading…
Reference in New Issue
Block a user