Loading...
 
Skip to main content

MWTable does not work correctly

Status
Open
Subject
MWTable does not work correctly
Version
3.x
6.x
Category
  • Less than 30-minutes fix
Feature
Wiki Plugin (extends basic syntax)
Submitted by
DesertWolf
Lastmod by
DesertWolf
Rating
(0)
Description

if you use the example of the mwtable plugin

Copy to clipboard
{MWTABLE( wiki_classes=false )} style="width:50%", class="myclass" |+style="font-style:italic;"|My caption ? width="30%;" ?? style="background-color:yellow;" ! style="background-color:grey;"| Name ! Address |- style="background-color: red" | style="color: blue;" | Bill | The little house |- | Carol || The big house {MWTABLE}


you will get something like this:

Copy to clipboard
<table style="" width:50%="" ,="" class="normal br"> <caption style="" font-style:italic;=""> My caption<br></caption> <col 30%;="" width=""> <col style=""> <tbody><tr> <th style="" background-color:grey;="">Name<br></th> <th>Address<br></th> </tr> <tr style="" background-color:=""> <td style="" color:="">Bill<br></td> <td>The little house<br></td> </tr> <tr> <td>Carol</td> <td>The big house<br></td> </tr> </tbody></table>


you see that the attributes are not translated right.

as well there is a problem with a space like "color: blue"

and another addition: doesn't recognise colors in hexadecimal format (#rrggbb)

it happens in version 3.x and as well as in version 6.1 i am testing right now.

Solution

In lines 346/347 of tikidir/lib/wiki-plugins/wikiplugin_mwtable.php you have something like:

Copy to clipboard
$value = str_replace("'", "", $value); $value = str_replace("&quot;", "", $value);


add the following line below that:

Copy to clipboard
$value = str_replace("\"", "", $value);


To fix the space and hexadecimal problem change line 342 from:

Copy to clipboard
if (preg_match("#([(&quot;)\"'\w:;%-/\.]+)(?=\s|\Z)#",$string,$matches,PREG_OFFSET_CAPTURE,$cur_pos)) {

to

Copy to clipboard
if (preg_match("#([(&quot;)\"'\w\#:;%-/\.]+)(?=\s|\Z)#",$string,$matches,PREG_OFFSET_CAPTURE,$cur_pos)) {


(moved the /s from the second to the first group)

Edit: space problem still not solved

Importance
5
Priority
25
Demonstrate Bug on Tiki 19+
Demonstrate Bug (older Tiki versions)
Ticket ID
3795
Created
Tuesday 15 February, 2011 08:58:40 UTC
by DesertWolf
LastModif
Tuesday 15 February, 2011 11:39:08 UTC


Show PHP error messages