|
@@ -1,9 +1,39 @@
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
+import os
|
|
|
import fileinput
|
|
|
+import re
|
|
|
+import sys
|
|
|
|
|
|
-for line in fileinput.input("glife.html", inplace=True, encoding="utf-8"):
|
|
|
- #print('{} {}'.format(fileinput.filelineno(), line), end='')
|
|
|
- print(line, end='')
|
|
|
- if line.strip() == '<head>':
|
|
|
- print('<meta name="rating" content="adult" />', end='')
|
|
|
+
|
|
|
+
|
|
|
+file_path_html = 'glife.html'
|
|
|
+deprecatedTag = "deprecated"
|
|
|
+
|
|
|
+data = ''
|
|
|
+
|
|
|
+
|
|
|
+with open(file_path_html, 'r') as file:
|
|
|
+ data = file.read()
|
|
|
+
|
|
|
+dataLengthInitial = len(data)
|
|
|
+
|
|
|
+dataWithoutDeprecated = data
|
|
|
+
|
|
|
+i = 0
|
|
|
+regex = r"""<tw-passagedata pid="(\d+)" name="([\s\w]+)" tags="(.*?)" (?:position="\d+,\d+" )?(?:size="\d+,\d+")?>(.*?)</tw-passagedata>"""
|
|
|
+for match in re.finditer(regex,data,re.S):
|
|
|
+ tags = match.group(3).split()
|
|
|
+
|
|
|
+ if(deprecatedTag in tags):
|
|
|
+ dataWithoutDeprecated = dataWithoutDeprecated.replace(match.group(0),'')
|
|
|
+ print('Removed:'+match.group(2))
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+with open(file_path_html, 'w') as file:
|
|
|
+ file.write(dataWithoutDeprecated)
|
|
|
+
|
|
|
+dataLengthEnd = len(dataWithoutDeprecated)
|
|
|
+
|
|
|
+print(f'POSTCOMPILE DONE, REMAINING SIZE {round(dataLengthEnd/dataLengthInitial*100,1)}%')
|