mirror of
https://github.com/FAUSheppy/flask-json-dream-website
synced 2026-01-22 03:07:37 +01:00
update combiner
This commit is contained in:
17
combiner.py
17
combiner.py
@@ -30,15 +30,10 @@ for key, value in MAP.items():
|
|||||||
phpFile = os.path.join(TARGET_DIR, key)
|
phpFile = os.path.join(TARGET_DIR, key)
|
||||||
response = requests.get("http://localhost:5000" + value)
|
response = requests.get("http://localhost:5000" + value)
|
||||||
mobileFile = os.path.join(TARGET_DIR, key[:-4]) + "-mobile.php"
|
mobileFile = os.path.join(TARGET_DIR, key[:-4]) + "-mobile.php"
|
||||||
|
|
||||||
with open(mobileFile, "w") as f:
|
with open(mobileFile, "w") as f:
|
||||||
f.write(response.content.decode("utf-8"))
|
|
||||||
|
|
||||||
# read old toplevel file #
|
|
||||||
contentNew = []
|
|
||||||
with open(os.path.join(TARGET_DIR, key), "r") as f:
|
|
||||||
|
|
||||||
foundStart = False
|
foundStart = False
|
||||||
for l in f:
|
for l in response.content.decode("utf-8").split("\n"):
|
||||||
|
|
||||||
# look for start #
|
# look for start #
|
||||||
if not foundStart:
|
if not foundStart:
|
||||||
@@ -51,6 +46,14 @@ for key, value in MAP.items():
|
|||||||
if "</body>" in l or "</html>" in l:
|
if "</body>" in l or "</html>" in l:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
f.write(l)
|
||||||
|
|
||||||
|
# read old toplevel file #
|
||||||
|
contentNew = []
|
||||||
|
with open(os.path.join(TARGET_DIR, key), "r") as f:
|
||||||
|
|
||||||
|
for l in f:
|
||||||
|
|
||||||
contentNew += [l]
|
contentNew += [l]
|
||||||
if "footerbereich" in l:
|
if "footerbereich" in l:
|
||||||
contentNew += [ "require('{}');\n".format(key[:-4] + "-mobile.php") ]
|
contentNew += [ "require('{}');\n".format(key[:-4] + "-mobile.php") ]
|
||||||
|
|||||||
Reference in New Issue
Block a user