Extension:IndentSections
From MediaWiki.org
|
IndentSections Release status: beta |
|
|---|---|
| Implementation | User interface |
| Description | Indents all sections according to their headers. |
| Author(s) | James Paige |
| Version | 0.1 (Mar 19 2008) |
| MediaWiki | tested 1.13.x (likely to work with 1.7.x) |
| Download | no link |
| Hooks used | |
[edit] What can this extension do?
This extension causes all sections to be automatically indented as if they were inside nested blockquotes like this:
[edit] 6.0 RESOURCE MANAGEMENT
[edit] 6.1
Executive management shall participate in all resource discussions, and shall make the final decision on all significant expenditures. Resource allocation considerations shall include, but are not limited to: time, personnel requirements, salaries, skill levels, outsourcing, material, processes, and any other factors required to ensure adequate resources are available to achieve customer satisfaction.
[edit] 6.1.1
Executive management shall consider data from corrective and preventive action, non-conformance reports, audit results, employee communications, management review activities, customer ratings, financial reports, and business conditions to determine resource requirements.
[edit] 6.2
Executive management shall meet at a minimum of once per month or more often, as business dictates, to discuss resource requirements. (See Agenda Check Sheet)
This is suitable for corporate documentation wikis that mainly use sections to represent paragraphs of outline-structured business procedures.
[edit] Installation
Save the code below to extensions/IndentSections/IndentSections.php
[edit] Changes to LocalSettings.php
require_once($IP.'/extensions/IndentSections/IndentSections.php');
[edit] Code
<?php /* * Copyright © 2008, James Paige & West Coast Aerospace, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ //---Identify the extension--- $wgExtensionCredits['other'][] = array( 'name' => 'IndentSections', 'version' => '0.1', 'author' => 'James Paige', 'url' => 'http://www.mediawiki.org/wiki/Extension:IndentSections', 'description' => 'Indents all sections according to their headers.', ); //---Set up the hooks--- $wgHooks['BeforePageDisplay'][] = 'fnIndentSectionsBeforePageDisplay'; //---These two functions do the real work--- function fnIndentSectionsBeforePageDisplay(&$out) { $text =& $out->mBodytext; for($i = 6; $i > 1; $i -= 1){ $pattern = sprintf('/(<h%d> ?<span class="editsection">.*?)(<h[1-%d]>)/ms', $i, $i-1); $text = preg_replace_callback($pattern, fnIndentSectionsCallback, $text); } return true; } function fnIndentSectionsCallback($matches){ return '<blockquote>' . $matches[1] . '</blockquote>' . $matches[2]; }
[edit] Contact
If you have questions or suggestions, please use the talk page here.
[edit] Similar Extensions
For greater control over styling nested sections, see Extension:StyleBySection.

