inicio de links en python
This commit is contained in:
parent
9fc2fc8c73
commit
4cafced81a
|
@ -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('')
|
Loading…
Reference in New Issue