Escape sequences
This commit is contained in:
		@@ -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)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user