@ng-cn/core 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import re
|
|
3
|
+
|
|
4
|
+
def process_html_file(file_path):
|
|
5
|
+
with open(file_path, 'r', encoding='utf-8') as file:
|
|
6
|
+
content = file.read()
|
|
7
|
+
|
|
8
|
+
# Replace classes
|
|
9
|
+
new_content = re.sub(r'\bmr-', 'me-', content)
|
|
10
|
+
new_content = re.sub(r'\bml-', 'ms-', new_content)
|
|
11
|
+
new_content = re.sub(r'\btext-left\b', 'text-start', new_content)
|
|
12
|
+
new_content = re.sub(r'\btext-right\b', 'text-end', new_content)
|
|
13
|
+
|
|
14
|
+
if new_content != content:
|
|
15
|
+
with open(file_path, 'w', encoding='utf-8') as file:
|
|
16
|
+
file.write(new_content)
|
|
17
|
+
return True
|
|
18
|
+
return False
|
|
19
|
+
|
|
20
|
+
def traverse_and_process(directory):
|
|
21
|
+
for root, _, files in os.walk(directory):
|
|
22
|
+
for file in files:
|
|
23
|
+
if file.endswith('.html'):
|
|
24
|
+
file_path = os.path.join(root, file)
|
|
25
|
+
if process_html_file(file_path):
|
|
26
|
+
print(f"Changes made to: {file_path}")
|
|
27
|
+
|
|
28
|
+
if __name__ == "__main__":
|
|
29
|
+
src_directory = 'src'
|
|
30
|
+
traverse_and_process(src_directory)
|