r86061 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86060‎ | r86061 | r86062 >
Date:17:42, 14 April 2011
Author:bawolff
Status:ok (Comments)
Tags:
Comment:
Allow people to use ' entity (sinqle quote character: ') in wikitext.

It probably wasn't included originally, as its not part of html4,
but was introduced in XML/XHTML1. Since we do all sorts of weird stuff
with ' characters (italic/bold) its probably good to allow lowly users to
have an easy to remember way of escaping it.

There's also a whole bunch of entities in html5 that we should maybe consider
decoding as well.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Sanitizer.php (modified) (history)

Diff [purge]

Index: trunk/phase3/RELEASE-NOTES
@@ -236,6 +236,7 @@
237237 * (bug 28372) Fix bogus link to suppressed file versions in ForeignDBRepo
238238 * (bug 27473) Fix regression: bold, italic no longer interfere with linktrail for ca, kaa
239239 * (bug 28444) Fix regression: edit-on-doubleclick retains revision id again
 240+* ' character entity is now allowed in wikitext
240241
241242 === API changes in 1.18 ===
242243 * (bug 26339) Throw warning when truncating an overlarge API result
Index: trunk/phase3/includes/Sanitizer.php
@@ -45,6 +45,7 @@
4646 /**
4747 * List of all named character entities defined in HTML 4.01
4848 * http://www.w3.org/TR/html4/sgml/entities.html
 49+ * As well as ' which is only defined starting in XHTML1.
4950 * @private
5051 */
5152 static $htmlEntities = array(
@@ -63,6 +64,7 @@
6465 'amp' => 38,
6566 'and' => 8743,
6667 'ang' => 8736,
 68+ 'apos' => 39,
6769 'Aring' => 197,
6870 'aring' => 229,
6971 'asymp' => 8776,

Follow-up revisions

RevisionCommit summaryAuthorDate
r89681Followup to r86061: add parser test case to confirm that '&apos' in wikitext ...brion20:11, 7 June 2011

Comments

#Comment by Hashar (talk | contribs)   19:43, 7 June 2011

The comment still refers to the HTML4 norm. Maybe use another array for HTML5 or XML/XHTML1 then merge them in a new $allowedHTMLEntities.

#Comment by Brion VIBBER (talk | contribs)   20:15, 7 June 2011

The comment says that apos is from XHTML 1 and higher so that seems fine. I added a more specific comment on that line, and a parser test case to confirm that apos doesn't make it to output, in r89681.

#Comment by Hashar (talk | contribs)   06:28, 9 June 2011

Good to me!

Status & tagging log