Skip to content

Commit 7d4bb23

Browse files
authored
Use namespaced Html class if available (#131)
This fixes compatibility with MW 1.44. Issue: #127
1 parent d4c30e4 commit 7d4bb23

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/MermaidParserFunction.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Mermaid;
44

55
use Parser;
6-
use Html;
76
use MediaWiki\MediaWikiServices;
87

98
/**
@@ -81,7 +80,13 @@ public function parse( array $params ) {
8180
$content = implode( "|", $mwParams );
8281
$graphConfig = array_merge( $graphConfig, $mermaidConfig );
8382

84-
return Html::rawElement(
83+
if ( class_exists( 'MediaWiki\\Html\\Html' ) ) {
84+
// MW 1.40+
85+
$htmlClass = \MediaWiki\Html\Html::class;
86+
} else {
87+
$htmlClass = \Html::class;
88+
}
89+
return $htmlClass::rawElement(
8590
'div',
8691
[
8792
'class' => $class,
@@ -92,7 +97,7 @@ public function parse( array $params ) {
9297
]
9398
)
9499
],
95-
Html::rawElement(
100+
$htmlClass::rawElement(
96101
'div',
97102
[
98103
'class' => 'mermaid-dots',

0 commit comments

Comments
 (0)