Opened 8 years ago

Closed 4 years ago

#2069 closed Bug (wontfix)

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 ?

Attachments (1)

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

Download all attachments as: .zip

Change History (12)

comment:1 Changed 8 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 8 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

I also tried the following on the sandbox(, and the template is applied properly

{| {{Tableheader}} ! A ! B

|1 |2 |}


comment:3 Changed 8 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

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

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):

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

comment:8 Changed 7 years ago by andrew

  • Resolution fixed deleted
  • Status changed from closed to reopened

The patch was reverted. Awaiting a further suggested patch at

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 7 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
  • Resolution set to wontfix
  • Status changed from reopened to closed

MediaWiki and FCKeditor are no longer supported. Closing the ticket

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