1
- import os , re
1
+ import os
2
+ import re
2
3
3
4
SOLUTION_FOLDER = "./docs/solution"
4
5
SERIALWISE = "./docs/SERIALWISE.md"
5
6
TOPICWISE = "./docs/TOPICWISE.md"
6
7
SIDEBAR = "./docs/.vitepress/Sidebar.js"
7
8
9
+ TAGS = {
10
+ "BIT" : "Binary Indexed Tree" ,
11
+ "BS" : "Binary Search" ,
12
+ "BST" : "Binary Search Tree" ,
13
+ "Bit Manip" : "Bit Manipulation" ,
14
+ "BFS" : "Breadth First Search" ,
15
+ "DFS" : "Depth First Search" ,
16
+ "DNC" : "Divide and Conquer" ,
17
+ "DLL" : "Doubly Linked List" ,
18
+ "DP" : "Dynamic Programming" ,
19
+ "LL" : "Linked List" ,
20
+ "MEM" : "Memoization" ,
21
+ "MST" : "Minimum Spanning Tree" ,
22
+ "Q" : "Queue" ,
23
+ "ST" : "Stack" ,
24
+ "TAB" : "Tabulation" ,
25
+ "2P" : "Two Pointers" ,
26
+ }
27
+
8
28
9
29
def refactor_serialwise ():
10
30
with open (SERIALWISE , "r" , encoding = "utf-8" ) as file :
11
31
readme = file .read ()
12
32
with open (SERIALWISE , "w" , encoding = "utf-8" ) as file :
13
33
readme = (
14
34
readme .replace ("../docs/public" , "" )
35
+ .replace ("/\n " , ".md\n " )
15
36
.replace (
16
37
"<kbd>Ctrl</kbd>+<kbd>F</kbd> or <kbd>⌘</kbd>+<kbd>F</kbd>" ,
17
38
"`Ctrl`+`F` or `⌘`+`F`" ,
18
39
)
19
- .replace ("/\n " , ".md\n " )
20
40
)
41
+ for key , value in TAGS .items ():
42
+ readme = readme .replace (key , value )
21
43
if "./solution/" not in readme :
22
44
readme = readme .replace ("]: ./" , "]: ./solution/" )
23
45
file .write (readme )
@@ -27,15 +49,18 @@ def refactor_topicwise():
27
49
with open (TOPICWISE , "r" , encoding = "utf-8" ) as file :
28
50
readme = file .read ()
29
51
with open (TOPICWISE , "w" , encoding = "utf-8" ) as file :
30
- file . write (
52
+ readme = (
31
53
readme .replace ("docs/public" , "" )
54
+ .replace ("/\n " , ".md\n " )
55
+ .replace ("./src/" , "./solution/" )
32
56
.replace (
33
57
"<kbd>Ctrl</kbd>+<kbd>F</kbd> or <kbd>⌘</kbd>+<kbd>F</kbd>" ,
34
58
"`Ctrl`+`F` or `⌘`+`F`" ,
35
59
)
36
- .replace ("./src/" , "./solution/" )
37
- .replace ("/\n " , ".md\n " )
38
60
)
61
+ for key , value in TAGS .items ():
62
+ readme = readme .replace (key , value )
63
+ file .write (readme )
39
64
40
65
41
66
def refactor_sidebar ():
@@ -86,8 +111,8 @@ def refactor_readmes():
86
111
87
112
def main ():
88
113
refactor_serialwise ()
89
- refactor_topicwise ()
90
- refactor_sidebar ()
114
+ # refactor_topicwise()
115
+ # refactor_sidebar()
91
116
refactor_readmes ()
92
117
93
118
0 commit comments