Ticket #2069 (closed Bug: wontfix)

Opened 7 years ago

Last modified 4 years ago

Table issue with template and heading

Reported by: 360R8 Owned by:
Priority: Normal Milestone:
Component: Project : MediaWiki+FCKeditor Version: FCKeditor 2.5.1
Keywords: Cc:


If I have a table like this {| {{table}}

! A

! 1 | 2 |} After using the editor it gets munged like this {|

| A | B

| 1 | 2 |} Table template removed, and headings changed from ! to |. Any workarounds for this ?


2069.patch (3.1 KB) - added by wwalc 7 years ago.

Change History

comment:1 Changed 7 years ago by wwalc

  • Keywords WorksForMe Pending added; table template headings removed

Check the latest version of MediaWiki extension. Problem with table headers has been fixed today (#2044).

I believe that {{table}} can't appear after {|. I tried to add the following text

{| {{table}}
 ! A || B
 ! 1
 | 2

in MediaWiki Sandbox and the table template has been stripped as well, so the behaviour seems to be correct.

comment:2 Changed 7 years ago by 360R8


thank you for the quick fix on table headers.

For embeding template in table syntax, please take a look at this wiki source http://www.mediawiki.org/wiki/Template:Tableheader

I also tried the following on the sandbox(http://www.mediawiki.org/wiki/Sandbox), and the template is applied properly

{| {{Tableheader}} ! A ! B

|1 |2 |}


comment:3 Changed 7 years ago by wwalc

  • Keywords Confirmed added; WorksForMe Pending removed

Changed 7 years ago by wwalc

comment:4 Changed 7 years ago by wwalc

  • Keywords HasPatch added

I'm attaching a patch. It relies on a hook that doesn't exist yet. With this patch, if template is inside of a tag, it is not surrounded by a <span> tag. It is also required to tell Sanitizer to not remove our special word that is replaced with the template content at the end of processing, that's why new hook is necessary.

In includes/Sanitizer.php, function fixTagAttributes, add this before the last line (with return statement):

if ( !wfRunHooks( 'SanitizerAfterFixTagAttributes', array( $text, $element, &$attribs ) ) ) {
	return '';

it should look similar to:

static function fixTagAttributes( $text, $element ) {
	if( trim( $text ) == '' ) {
		return '';

	$stripped = Sanitizer::validateTagAttributes(
		Sanitizer::decodeTagAttributes( $text ), $element );

	$attribs = array();
	foreach( $stripped as $attribute => $value ) {
		$encAttribute = htmlspecialchars( $attribute );
		$encValue = Sanitizer::safeEncodeAttribute( $value );

		$attribs[] = "$encAttribute=\"$encValue\"";
	if ( !wfRunHooks( 'SanitizerAfterFixTagAttributes', array( $text, $element, &$attribs ) ) ) {
		return '';
	return count( $attribs ) ? ' ' . implode( ' ', $attribs ) : '';

Let me know if that worked for you.

comment:5 Changed 7 years ago by wwalc

  • Status changed from new to closed
  • Resolution set to fixed

Fixed with [1941].

comment:6 Changed 7 years ago by wwalc

#2147 marked as DUP.

comment:7 Changed 7 years ago by wwalc

Hook added to the core in MediaWiki 1.13 (r33726, r33725): https://bugzilla.wikimedia.org/show_bug.cgi?id=13821.

Users of MW 1.10-1.12 must apply changes in includes/Sanitizer.php manually.

comment:8 Changed 7 years ago by andrew

  • Status changed from closed to reopened
  • Resolution fixed deleted

The patch was reverted. Awaiting a further suggested patch at https://bugzilla.wikimedia.org/show_bug.cgi?id=13821

comment:9 Changed 7 years ago by cneubauer

This fix doesn't seem to work for me. After adding the hook into MediaWiki, I added a template to a table header and switched back and forth between wikitext view and fck view. The template seems to be remain (which is good). But it gets converted to all lowercase text. So {| {{TableStyle}} becomes {| {{tablestyle}} (which is bad).

Also, if I save a page with a table style header when FCK is disabled and then reenable FCK and edit that page, the style header is gone. So I can't edit a page, save it, and then edit it again basically.

comment:10 Changed 6 years ago by ma2xx

  • Keywords Patch reverted added; HasPatch removed

*Push* The problem is already present in V2.6.4 and MediaWiki 1.13. Can anybody find a working solution please?!

comment:11 Changed 4 years ago by krst

  • Keywords Confirmed Patch reverted removed
  • Status changed from reopened to closed
  • Resolution set to wontfix

MediaWiki and FCKeditor are no longer supported. Closing the ticket

Note: See TracTickets for help on using tickets.
© 2003 – 2012 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy