diff --git a/LocalWiki.php b/LocalWiki.php index 6fa17af195..767572fa33 100644 --- a/LocalWiki.php +++ b/LocalWiki.php @@ -10,6 +10,34 @@ // Per-wiki settings that are incompatible with LocalSettings.php switch ( $wi->dbname ) { + case 'acuralegendwiki': + /* The following code block is a [modification] of [Extension:IndentSections] + * and is licensed under the [MIT License]. + * + * [modification]: https://issue-tracker.miraheze.org/T12969 + * [Extension:IndentSections]: https://www.mediawiki.org/wiki/Extension:IndentSections + * [MIT License]: https://opensource.org/licenses/mit-license.php + */ + $wgHooks['BeforePageDisplay'][] = 'fnIndentSectionsBeforePageDisplay'; + + function fnIndentSectionsBeforePageDisplay( $out, $skin ) { + $text = $out->getHTML(); + + for ( $i = 6; $i >= 1; $i -= 1 ) { + $pattern = sprintf( '/(\s*?)(.*?)(?=(|\Z))/ms', $i, $i, $i ); + //$pattern = sprintf( '/(]+><\/a>\s*?.*?<\/h%d>)(.*?)(?=(]+><\/a>|\Z))/ms', $i, $i, $i ); + $text2 = preg_replace( $pattern, '$1
$2
', $text ); + if ( $text2 !== null ) { + $text = $text2; + } + } + + $out->clearHTML(); + $out->addHTML( $text ); + return true; + } + + break; case 'aieseattlewiki': $wgUploadWizardConfig = [ 'campaignExpensiveStatsEnabled' => false,