incoming links for multiple wikilinks in a line
This commit is contained in:
parent
275898c511
commit
e539d2a428
7
links.py
7
links.py
|
@ -32,13 +32,14 @@ for filename in os.listdir():
|
|||
pre_mode = not pre_mode
|
||||
if pre_mode: # skip preformatted mode
|
||||
continue
|
||||
m=re.search("\{[^{}]+\}",line)
|
||||
if m:
|
||||
match = m.group(0) # get matched string
|
||||
while re.search("\{[^{}]+\}",line):
|
||||
m = re.search("\{[^{}]+\}",line)
|
||||
match = m.group() # matched string
|
||||
if match not in incoming: # create a new set for that page
|
||||
incoming[match] = set()
|
||||
# add this file
|
||||
incoming[match].add(wikilink)
|
||||
line = line[m.end()+1:]
|
||||
file.close()
|
||||
|
||||
os.chdir('../tmp/')
|
||||
|
|
Loading…
Reference in New Issue