diff --git a/links.py b/links.py new file mode 100644 index 0000000..ed6f6ef --- /dev/null +++ b/links.py @@ -0,0 +1,30 @@ +import re +import os + +def filename2Wikilink( s ): + s = s.replace('_',' ') + s = s.replace('.gmo','') + return '{'+s+'}' + +os.chdir('src/') + +matches = {} + +for filename in os.listdir(): + if filename.endswith('.gmo') and filename != 'pages.gmo' and filename != 'index.gmo': + wikilink=filename2Wikilink(filename) + + with open(filename) as f: + for line in f: + m=re.search("\{.+\}",line) + if m: + # print(m) + match = m.group(0) + if match not in matches: + matches[match] = set() + matches[match].add(wikilink) + +for k,v in matches.items(): + print(k) + print(v) + print('')