Skip to content

Commit

Permalink
refactor: remove unused code from TabberParsoid class
Browse files Browse the repository at this point in the history
TabberParsoid is currently unused but it is kept for development purpose.
  • Loading branch information
alistair3149 authored Jan 5, 2025
1 parent a003ee0 commit 4e0e2bc
Showing 1 changed file with 1 addition and 48 deletions.
49 changes: 1 addition & 48 deletions includes/TabberParsoid.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,53 +47,6 @@ public function sourceToDom( ParsoidExtensionAPI $extApi, string $src, array $ex
* @return string HTML
*/
public static function render( ParsoidExtensionAPI $extApi, string $src ): string {
$arr = explode( '|-|', $src );
$htmlTabs = '';
foreach ( $arr as $tab ) {
$htmlTabs .= self::buildTab( $extApi, $tab );
}

return '<div class="tabber">' .
'<header class="tabber__header"></header>' .
'<section class="tabber__section">' . $htmlTabs . "</section></div>";
}

/**
* Build individual tab.
*
* @param ParsoidExtensionAPI $extApi
* @param string $tab Tab information
*
* @return string HTML
*/
private static function buildTab( ParsoidExtensionAPI $extApi, string $tab ): string {
if ( empty( trim( $tab ) ) ) {
return '';
}

// Use array_pad to make sure at least 2 array values are always returned
[ $tabName, $tabBody ] = array_pad( explode( '=', $tab, 2 ), 2, '' );

/*
* Use language converter to get variant title and also escape html
* FIXME: No replacement method yet
* See T85581, T272943
*/
// $tabName = $parser->getTargetLanguageConverter()->convertHtml( trim( $tabName ) );
$tabBody = $extApi->domToHTML(
$extApi->wikitextToDOM(
$tabBody,
[
'parseOpts' => [
'extTag' => 'tabber',
'context' => 'inline',
]
],
true // sol
)
);

return '<article class="tabber__panel" title="' . $tabName .
'">' . $tabBody . '</article>';
// TODO: Check Parsoid support
}
}

0 comments on commit 4e0e2bc

Please sign in to comment.