diff --git a/truewiki/namespaces/category/wikilink.py b/truewiki/namespaces/category/wikilink.py index 64278c8..f3c124b 100644 --- a/truewiki/namespaces/category/wikilink.py +++ b/truewiki/namespaces/category/wikilink.py @@ -11,7 +11,7 @@ def replace(instance: WikiPage, wikilink: wikitextparser.WikiLink): # This indicates that the page belongs to this category. We update # the WikiPage to indicate this, and otherwise remove the WikiLink. - category = wikilink.target[len("category:") :] + category = wikilink.target[len("category:") :].strip() error = instance.page_is_valid(f"Category/{category}") if error: @@ -24,7 +24,7 @@ def replace(instance: WikiPage, wikilink: wikitextparser.WikiLink): def link(instance: WikiPage, wikilink: wikitextparser.WikiLink): - target = wikilink.target[len(":category:") :] + target = wikilink.target[len(":category:") :].strip() # Generate a link to the language root, which will list all categories # of that language. diff --git a/truewiki/namespaces/file/wikilink.py b/truewiki/namespaces/file/wikilink.py index f52682e..986eaa6 100644 --- a/truewiki/namespaces/file/wikilink.py +++ b/truewiki/namespaces/file/wikilink.py @@ -12,8 +12,7 @@ def link_file(instance: WikiPage, wikilink: wikitextparser.WikiLink): - target = wikilink.target - target = target[len(":file:") :] + target = wikilink.target[len(":file:") :].strip() # Generate a link to the language root, which will list all templates # of that language. @@ -27,7 +26,7 @@ def link_file(instance: WikiPage, wikilink: wikitextparser.WikiLink): def link_media(instance: WikiPage, wikilink: wikitextparser.WikiLink): target = wikilink.target - target = target[len("media:") :] + target = target[len("media:") :].strip() url = f"File/{target}" diff --git a/truewiki/namespaces/folder/wikilink.py b/truewiki/namespaces/folder/wikilink.py index 6ab3f59..2574560 100644 --- a/truewiki/namespaces/folder/wikilink.py +++ b/truewiki/namespaces/folder/wikilink.py @@ -9,7 +9,7 @@ def link(instance: WikiPage, wikilink: wikitextparser.WikiLink): - target = wikilink.target[len(":folder:") :] + target = wikilink.target[len(":folder:") :].strip() # As we are browsing folders, [[Folder:en]] and [[Folder:en/]] are # identical in meaning. diff --git a/truewiki/namespaces/template/wikilink.py b/truewiki/namespaces/template/wikilink.py index 3d73685..d89a8e8 100644 --- a/truewiki/namespaces/template/wikilink.py +++ b/truewiki/namespaces/template/wikilink.py @@ -13,7 +13,7 @@ def link_and_replace(instance: WikiPage, wikilink: wikitextparser.WikiLink): if target.startswith(":"): target = target[1:] - target = target[len("template:") :] + target = target[len("template:") :].strip() # Generate a link to the language root, which will list all templates # of that language. diff --git a/truewiki/namespaces/translation/wikilink.py b/truewiki/namespaces/translation/wikilink.py index 55970b6..45deb16 100644 --- a/truewiki/namespaces/translation/wikilink.py +++ b/truewiki/namespaces/translation/wikilink.py @@ -9,7 +9,7 @@ def replace(instance: WikiPage, wikilink: wikitextparser.WikiLink): - page = wikilink.target[len("translation:") :] + page = wikilink.target[len("translation:") :].strip() error = instance.page_is_valid(f"{page}") if error: