Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T12969: Add requested hook for acuralegendwiki #5766

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading