在MediaWiki的移动版本中,H2部分是可扩展的。我希望H3(和H4,如果可能的话)的子章节也是可扩展的。这怎么可能?谢谢!
我在MobileFrontEnd / includes / MobileFormatter.php中找到了这个,也许可以修改它:
/**
* Makes sections expandable
*
* @param string $s
* @param string $tagName
* @return string
*/
protected function headingTransform( $s, $tagName = 'h2' ) {
wfProfileIn( __METHOD__ );
$tagRegEx = '<' . $tagName . '.*</' . $tagName . '>';
$s = $this->pageTransformStart .
preg_replace(
'%(' . $tagRegEx . ')%sU', $this->headingTransformStart . '\1' . $this->headingTransformEnd,
$s
) .
$this->pageTransformEnd;
wfProfileOut( __METHOD__ );
return $s;
}
protected function onHtmlReady( $html ) {
wfProfileIn( __METHOD__ );
if ( $this->expandableSections ) {
$tagName = strrpos( $html, '<h1' ) !== false ? 'h1' : 'h2';
$html = $this->headingTransform( $html, $tagName );
}
wfProfileOut( __METHOD__ );
return $html;
}