Browse Source

generate_links works now

master
Cristina Cochior 6 years ago
parent
commit
f463bcbf23
  1. 11
      generate_links.py

11
generate_links.py

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

Loading…
Cancel
Save