fix: Add escape char for curl rendering and format python files
This commit is contained in:
25
cleanSite.py
25
cleanSite.py
@@ -1,36 +1,37 @@
|
||||
import os
|
||||
|
||||
def cleanSite(path:str):
|
||||
|
||||
def cleanSite(path: str):
|
||||
# Check if the file is sitemap.xml
|
||||
if path.endswith('sitemap.xml'):
|
||||
if path.endswith("sitemap.xml"):
|
||||
# Open the file
|
||||
with open(path, 'r') as f:
|
||||
with open(path, "r") as f:
|
||||
# Read the content
|
||||
content = f.read()
|
||||
# Replace all .html with empty string
|
||||
content = content.replace('.html', '')
|
||||
content = content.replace(".html", "")
|
||||
# Write the content back to the file
|
||||
with open(path, 'w') as f:
|
||||
with open(path, "w") as f:
|
||||
f.write(content)
|
||||
# Skip the file
|
||||
return
|
||||
|
||||
|
||||
# If the file is not an html file, skip it
|
||||
if not path.endswith('.html'):
|
||||
if not path.endswith(".html"):
|
||||
if os.path.isdir(path):
|
||||
for file in os.listdir(path):
|
||||
cleanSite(path + '/' + file)
|
||||
cleanSite(path + "/" + file)
|
||||
|
||||
return
|
||||
|
||||
# Open the file
|
||||
with open(path, 'r') as f:
|
||||
with open(path, "r") as f:
|
||||
# Read and remove all .html
|
||||
content = f.read().replace('.html"', '"')
|
||||
# Write the cleaned content back to the file
|
||||
with open(path, 'w') as f:
|
||||
with open(path, "w") as f:
|
||||
f.write(content)
|
||||
|
||||
|
||||
for file in os.listdir('templates'):
|
||||
cleanSite('templates/' + file)
|
||||
for file in os.listdir("templates"):
|
||||
cleanSite("templates/" + file)
|
||||
|
||||
Reference in New Issue
Block a user