Skip to content

Commit 445f50f

Browse files
HermanPeerenwilsonge
authored andcommitted
Fix the extra rendering in the displaytitle
when a page is not language specific
1 parent c5065f6 commit 445f50f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Model/HelpScreenModel.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,17 @@ private function processResponse() : void
345345
throw new \RuntimeException('Error fetching page from MediaWiki API.');
346346
}
347347

348+
$title = $this->responseBody['parse']['displaytitle'];
349+
// Fix the extra rendering in the displaytitle, when a page is not language specific
350+
$title = str_replace([
351+
'<span class="mw-page-title-namespace">',
352+
'<span class="mw-page-title-separator">',
353+
'<span class="mw-page-title-main">',
354+
'</span>'
355+
], '', $title);
356+
348357
// Store the title to be used later
349-
$this->title = $this->responseBody['parse']['displaytitle'];
358+
$this->title = $title;
350359

351360
// Store the URL slug to be used later
352361
$this->setPageUrlSlug($this->responseBody['parse']['title']);

0 commit comments

Comments
 (0)