Skip to content

Commit

Permalink
T12969: Add requested hook for acuralegendwiki (#5766)
Browse files Browse the repository at this point in the history
Closes T12969
  • Loading branch information
BlankEclair authored Jan 17, 2025
1 parent 98bc011 commit 86a3cfd
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions LocalWiki.php
Original file line number Diff line number Diff line change
Expand Up @@ -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( '/(<h%d>\s*?<span class="(?:editsection|mw-headline)".+?<\/h%d>)(.*?)(?=(<h[1-%d]>|\Z))/ms', $i, $i, $i );
//$pattern = sprintf( '/(<a[^>]+><\/a><h%d>\s*?<span class="(?:editsection|mw-headline)">.*?<\/h%d>)(.*?)(?=(<a[^>]+><\/a><h[1-%d]>|\Z))/ms', $i, $i, $i );
$text2 = preg_replace( $pattern, '$1<blockquote style="margin:0px 0px 0px 1.5em">$2</blockquote>', $text );
if ( $text2 !== null ) {
$text = $text2;
}
}

$out->clearHTML();
$out->addHTML( $text );
return true;
}

break;
case 'aieseattlewiki':
$wgUploadWizardConfig = [
'campaignExpensiveStatsEnabled' => false,
Expand Down

0 comments on commit 86a3cfd

Please sign in to comment.