Opened 16 years ago

Closed 13 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:

Description

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

! A
B

! 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 Wiktor Walc 16 years ago.

Download all attachments as: .zip

Change History (12)

comment:1 Changed 16 years ago by Wiktor Walc

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 16 years ago by 360R8

Hello,

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 |}

Thanks.

comment:3 Changed 16 years ago by Wiktor Walc

Keywords: Confirmed added; WorksForMe Pending removed

Changed 16 years ago by Wiktor Walc

Attachment: 2069.patch added

comment:4 Changed 16 years ago by Wiktor Walc

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 16 years ago by Wiktor Walc

Resolution: fixed
Status: newclosed

Fixed with [1941].

comment:6 Changed 16 years ago by Wiktor Walc

#2147 marked as DUP.

comment:7 Changed 16 years ago by Wiktor Walc

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 16 years ago by Andrew Garrett

Resolution: fixed
Status: closedreopened

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

comment:9 Changed 15 years ago by Christian

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 15 years ago by maxx

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 13 years ago by Krzysztof Studnik

Keywords: Confirmed Patch reverted removed
Resolution: wontfix
Status: reopenedclosed

MediaWiki and FCKeditor are no longer supported. Closing the ticket

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy