Skip to content
Snippets Groups Projects
Commit 1b9dce7d authored by Magnus Giesbert's avatar Magnus Giesbert
Browse files

Update wikibot.py

parent a5ea6df3
No related branches found
No related tags found
No related merge requests found
...@@ -13,7 +13,7 @@ def move_page(original_page, new_page, delete=False): ...@@ -13,7 +13,7 @@ def move_page(original_page, new_page, delete=False):
# update back links to new page # # update back links to new page #
backLinks = proxy.wiki.getBackLinks(original_page) backLinks = proxy.wiki.getBackLinks(original_page)
reg = rf"\[\[\s*{original_page}\s*\|(.*?)\]\]" # regex for dokuwiki links we want to replace reg = rf"\[\[\s*{original_page}\s*\|(.*?)\]\]" # regex for dokuwiki links we want to replace
_replacer = lambda matched : "[[" + new_page + "|" + matched.group(1) + "]]" # replace function _replacer = lambda matched : "[[" + new_page + "|" + matched.group(1) + "]]"
for page in backLinks: for page in backLinks:
content = proxy.wiki.getPage(page) content = proxy.wiki.getPage(page)
content = re.sub(reg, _replacer, content) content = re.sub(reg, _replacer, content)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment