Last modified: 2014-09-23 23:42:49 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T5787, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 3787 - Restrict section edit links to specific section levels
Restrict section edit links to specific section levels
Status: NEW
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
unspecified
All All
: Low enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch, patch-need-review
Depends on:
Blocks: editlinks
  Show dependency treegraph
 
Reported: 2005-10-24 08:36 UTC by Väinö Järvelä
Modified: 2014-09-23 23:42 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
The same patch as in description. (825 bytes, patch)
2005-10-24 10:42 UTC, Väinö Järvelä
Details
Modernized patch (3.22 KB, patch)
2012-04-24 22:31 UTC, Max Semenik
Details

Description Väinö Järvelä 2005-10-24 08:36:55 UTC
I noticed that using section edit links the pages can get really messy when using deep sectioning. So i made a 
small patch to MediaWiki 1.5.0 (i checked that CVS didn't have this feature yet either) to disable section links 
according to a set level. With this patch you set $wgEditSectionLevel to section level that you wish to have 
section edit links and everything under that level. Makes some pages much clearer to read.

I wasn't sure where i should submit this patch to get reviewed and maybe added to MediaWiki so i submitted it here. 
Couldn't come to the IRC channel because i'm at work right now.

Here is the patch:
--- includes/Parser.php.orig  2005-09-18 04:21:39.000000000 +0300
+++ includes/Parser.php  2005-10-24 11:14:39.000000000 +0300
@@ -2644,10 +2644,13 @@
                if ( empty( $head[$headlineCount] ) ) {
                    $head[$headlineCount] = '';
                }
-               if( $istemplate )
-                   $head[$headlineCount] .= $sk->editSectionLinkForOther($templatetitle, $templatesection);
-               else
-                   $head[$headlineCount] .= $sk->editSectionLink($this->mTitle, $sectionCount+1);
+               global $wgEditSectionLevel;
+               if ( $wgEditSectionLevel == 0 || $level <= $wgEditSectionLevel ) {
+                   if( $istemplate )
+                       $head[$headlineCount] .= $sk->editSectionLinkForOther($templatetitle, $templatesection);
+                   else
+                       $head[$headlineCount] .= $sk->editSectionLink($this->mTitle, $sectionCount+1);
+               }
            }

            # give headline the correct <h#> tag
Comment 1 Väinö Järvelä 2005-10-24 08:37:44 UTC
Sorry, should have included the patch as an attachment.
Comment 2 Väinö Järvelä 2005-10-24 10:42:40 UTC
Created attachment 1017 [details]
The same patch as in description.
Comment 3 p858snake 2011-04-30 00:10:00 UTC
*Bulk BZ Change: +Patch to open bugs with patches attached that are missing the keyword*
Comment 4 Sumana Harihareswara 2011-11-09 19:08:04 UTC
Adding the "need-review" keyword for patches that need review by developers.  Väinö Järvelä, thank you for your patch, and sorry it's taken so long for a response on this!

Do you still run into the problem that occasioned this bug report and fix, or has it been resolved in subsequent versions of MediaWiki?
Comment 5 Max Semenik 2012-04-24 22:31:43 UTC
Created attachment 10462 [details]
Modernized patch

Here's how it should look on modern MW, bar parser tests. The question here is whether this feature has enough demand to warrant its inclusion? Comments are welcome, probably worth a wikitech-l discussion.
Comment 6 Andre Klapper 2013-07-24 14:35:42 UTC
Max: Could you put that patch into Gerrit?

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links