r105284 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105283‎ | r105284 | r105285 >
Date:10:50, 6 December 2011
Author:hashar
Status:ok (Comments)
Tags:
Comment:
allow bold in TOC lines

just like r102179 allowed italics in TOC lines for bug 26375, this
patch allow bold text as well.
Modified paths:
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)
  • /trunk/phase3/tests/parser/parserTests.txt (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/parser/parserTests.txt
@@ -8957,6 +8957,23 @@
89588958
89598959 !! end
89608960
 8961+!! test
 8962+Bug 26375: TOC with bold
 8963+!! options
 8964+title=[[Main Page]]
 8965+!! input
 8966+__TOC__
 8967+== '''should be bold''' then normal text ==
 8968+!! result
 8969+<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
 8970+<ul>
 8971+<li class="toclevel-1 tocsection-1"><a href="#should_be_bold_then_normal_text"><span class="tocnumber">1</span> <span class="toctext"><b>should be bold</b> then normal text</span></a></li>
 8972+</ul>
 8973+</td></tr></table>
 8974+<h2><span class="editsection">[<a href="https://www.mediawiki.org/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: should be bold then normal text">edit</a>]</span> <span class="mw-headline" id="should_be_bold_then_normal_text"> <b>should be bold</b> then normal text </span></h2>
 8975+
 8976+!! end
 8977+
89618978 !! article
89628979 MediaWiki:Bug32057
89638980 !! text
Index: trunk/phase3/includes/parser/Parser.php
@@ -4051,7 +4051,7 @@
40524052
40534053 # Strip out HTML (other than plain <sup> and <sub>: bug 8393, or <i>: bug 26375)
40544054 $tocline = preg_replace(
4055 - array( '#<(?!/?(sup|sub|i)).*?'.'>#', '#<(/?(sup|sub|i)).*?'.'>#' ),
 4055+ array( '#<(?!/?(sup|sub|i|b)).*?'.'>#', '#<(/?(sup|sub|i|b)).*?'.'>#' ),
40564056 array( '', '<$1>' ),
40574057 $safeHeadline
40584058 );

Sign-offs

UserFlagDate
GWickeinspected13:44, 6 December 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r102179Bug 26375 - Italics should be passed to TOC...platonides15:07, 6 November 2011

Comments

#Comment by Platonides (talk | contribs)   20:42, 6 December 2011

What's the use case of this?

#Comment by Hashar (talk | contribs)   21:29, 6 December 2011

A commenter suggested it in a comment on bug 26375 so I thought it would be a good idea to allow that too.

#Comment by Hashar (talk | contribs)   21:29, 6 December 2011

Gabriel : looks like it will add some more madness to the JavaScript parser 8-)

#Comment by GWicke (talk | contribs)   21:39, 6 December 2011

This makes little difference to the JS parser, it is just element filtering (on tokens or the dom) after all.

To me bold in tocs does not appear to be terribly important. But then italics don't seem to be that much more important either. And the harm both can do is very limited.

Status & tagging log