only prefix namespace names onto titles that lack them
WikiqPage unconditionally prepended the namespace name to titles of pages outside the main namespace. mwxml >= 0.3.7 keeps the namespace prefix on the title when the dump carries <ns> tags (it previously stripped it), which made wikiq emit double-prefixed titles like "Category:Category:Alaska". Check for the prefix before adding it. mwxml still strips the prefix on its fallback path for dumps without <ns> tags, so those titles are still prefixed as before. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -385,8 +385,12 @@ class WikiqPage:
|
||||
# page.namespace is inconsistent with namespace_map
|
||||
if page.namespace not in namespace_map:
|
||||
page.namespace = 0
|
||||
# mwxml >= 0.3.7 keeps the namespace prefix on the title when the dump
|
||||
# has <ns> tags, but strips it on the no-<ns> fallback path
|
||||
if page.namespace != 0:
|
||||
page.title = ":".join([namespace_map[page.namespace], page.title])
|
||||
ns_prefix = namespace_map[page.namespace] + ":"
|
||||
if not page.title.startswith(ns_prefix):
|
||||
page.title = ns_prefix + page.title
|
||||
self.restrictions = page.restrictions
|
||||
self.collapse_user = collapse_user
|
||||
self.mwpage = page
|
||||
|
||||
Reference in New Issue
Block a user