|
|
@ -14,10 +14,7 @@ for path, subdirs, files in os.walk(path): |
|
|
|
with open(file, encoding='utf-8') as f: |
|
|
|
textfile = f.read() |
|
|
|
for word in wordlist_dict: |
|
|
|
wordlinked = "<a href='/diverge?search="+word+"'>"+word+"</a>" |
|
|
|
# wordlinked = re.escape(wordlinked) |
|
|
|
print(wordlinked) |
|
|
|
# word = re.escape(word) |
|
|
|
print(word) |
|
|
|
# textfile = re.sub(word, wordlinked, textfile) |
|
|
|
# print(textfile) |
|
|
|
word = re.escape(word) |
|
|
|
textfile = re.sub(r"(?<!<)(?<!</)(?<!ge\?)\b(%s)\b" %word, r"<a href='/diverge?search='\1'>\1</a>", textfile) |
|
|
|
|
|
|
|
print(textfile) |
|
|
|