From 5d2eeb1e4fda2f2b84f6033a9bcf0df3e2fda852 Mon Sep 17 00:00:00 2001 From: Magnus Giesbert <magnus@fsmpi.rwth-aachen.de> Date: Fri, 29 Jul 2022 00:00:28 +0200 Subject: [PATCH] Update wikibot.py --- wikibot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wikibot.py b/wikibot.py index a6f6012..9f6f9ee 100644 --- a/wikibot.py +++ b/wikibot.py @@ -12,10 +12,10 @@ def move_page(original_page, new_page, delete=False): proxy.wiki.putPage(new_page, page_content, {"sum":"Moved from " + original_page}) # update back links to new page # - backLinks = proxy.wiki.getBackLinks(original_page) + back_links = proxy.wiki.getBackLinks(original_page) reg = rf"\[\[\s*{original_page}\s*\|(.*?)\]\]" # regex for dokuwiki links we want to replace _replacer = lambda matched : "[[" + new_page + "|" + matched.group(1) + "]]" - for page in backLinks: + for page in back_links: content = proxy.wiki.getPage(page) content = re.sub(reg, _replacer, content) proxy.wiki.putPage(page, content, {"sum":"Update links from " +original_page+ " to " + new_page}) -- GitLab