Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F2424
sections.patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
bzimport
Nov 21 2014, 8:54 PM
2014-11-21 20:54:45 (UTC+0)
Size
3 KB
Referenced Files
None
Subscribers
None
sections.patch
View Options
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index 7c4db0d..51d1a8a 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -3143,6 +3143,11 @@ $wgEnableScaryTranscluding = false;
*/
$wgTranscludeCacheExpiry = 3600;
+/**
+ * Maximum heading level at which to include section edit links
+ */
+$wgEditSectionLevel = 6;
+
/** @} */ # end of parser settings }
/************************************************************************//**
diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php
index 20c8b95..785ac58 100644
--- a/includes/parser/Parser.php
+++ b/includes/parser/Parser.php
@@ -4193,7 +4193,9 @@ class Parser {
);
# give headline the correct <h#> tag
- if ( $maybeShowEditLink && $sectionIndex !== false ) {
+ if ( $maybeShowEditLink
+ && $sectionIndex !== false
+ && $level <= $this->mOptions->getEditSectionLevel() ) {
// Output edit section links as markers with styles that can be customized by skins
if ( $isTemplate ) {
# Put a T flag in the section identifier, to indicate to extractSections()
diff --git a/includes/parser/ParserOptions.php b/includes/parser/ParserOptions.php
index bf9611f..353b537 100644
--- a/includes/parser/ParserOptions.php
+++ b/includes/parser/ParserOptions.php
@@ -181,6 +181,11 @@ class ParserOptions {
var $mExtraKey = '';
/**
+ * @var Maximum heading level at which to include section edit links
+ */
+ var $mEditSectionLevel;
+
+ /**
* Function to be called when an option is accessed.
*/
protected $onAccessCallback = null;
@@ -219,6 +224,7 @@ class ParserOptions {
return $this->mIsPrintable; }
function getUser() { return $this->mUser; }
function getPreSaveTransform() { return $this->mPreSaveTransform; }
+ function getEditSectionLevel() { return $this->mEditSectionLevel; }
/**
* @param $title Title
@@ -306,6 +312,7 @@ class ParserOptions {
function setIsPreview( $x ) { return wfSetVar( $this->mIsPreview, $x ); }
function setIsSectionPreview( $x ) { return wfSetVar( $this->mIsSectionPreview, $x ); }
function setIsPrintable( $x ) { return wfSetVar( $this->mIsPrintable, $x ); }
+ function setEditSectionLevel( $x ) { return wfSetVar( $this->mEditSectionLevel, $x ); }
/**
* Extra key that should be present in the parser cache key.
@@ -380,7 +387,7 @@ class ParserOptions {
global $wgUseDynamicDates, $wgInterwikiMagic, $wgAllowExternalImages,
$wgAllowExternalImagesFrom, $wgEnableImageWhitelist, $wgAllowSpecialInclusion,
$wgMaxArticleSize, $wgMaxPPNodeCount, $wgMaxTemplateDepth, $wgMaxPPExpandDepth,
- $wgCleanSignatures, $wgExternalLinkTarget;
+ $wgCleanSignatures, $wgExternalLinkTarget, $wgEditSectionLevel;
wfProfileIn( __METHOD__ );
@@ -396,6 +403,7 @@ class ParserOptions {
$this->mMaxTemplateDepth = $wgMaxTemplateDepth;
$this->mCleanSignatures = $wgCleanSignatures;
$this->mExternalLinkTarget = $wgExternalLinkTarget;
+ $this->mEditSectionLevel = $wgEditSectionLevel;
$this->mUser = $user;
$this->mNumberHeadings = $user->getOption( 'numberheadings' );
diff --git a/maintenance/refreshLinks.php b/maintenance/refreshLinks.php
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2000
Default Alt Text
sections.patch (3 KB)
Attached To
Mode
T5787: Restrict section edit links to specific section levels
Attached
Detach File
Event Timeline
Log In to Comment