Patch for RichTable.php: enrich syntax for attributes

Marc-Etienne Vargenau <[email protected]> Mon, 07 Jan 2008 16:52:05 +0100
Newsgroups gmane.comp.web.wiki.phpwiki.patches
Organization Alcatel-Lucent (CTO/RDEI/SRA)
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------030009050607000902020106
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable

Hello Reini, hello to all,

Best wishes for 2008 to all.

Please find attached a patch to enrich the syntax for attributes
in the RichTable plugin.

The patch allows to use attributes with or without quotes (")
  border=3D1, cellpadding=3D"5"
  style=3D"font-family: sans-serif; border-top:1px solid #dddddd;

Before, it was not possible to use quotes, so you could not
do things like
style=3D"font-family: sans-serif; border-top:1px solid #dddddd;

It is still possible to write without quotes.

Perhaps the Plugin documentation can be updated also.

Reini, I have implemented the Mediawiki syntax for tables
(with a new plugin and a modification of the parser).
Are you interested that I submit that?

Best regards,

--=20
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D    ------
| Marc-Etienne Vargenau                                          |   /   =
   \
| Alcatel-Lucent France, Route de Villejust, 91620 NOZAY, FRANCE |  /  /|=
'`  \
| +33 (0)1 30 77 28 33, [email protected]  | |  /'|=
 '   |
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D  \   |/   /
| L'essence des Math=E9matiques est dans leur libert=E9.             |   =
\      /
|                                Georges Cantor                  |    ---=
---
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

--------------030009050607000902020106
Content-Type: text/plain;
 name="RichTable.php-patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="RichTable.php-patch"

--- RichTable.php	2008-01-07 11:56:38.000000000 +0100
+++ RichTable.php.new	2008-01-07 11:55:11.000000000 +0100
@@ -135,13 +135,18 @@
     }
 
     function _parse_attr($line) {
+        // We allow attributes with or without quotes (")
+        // border=1, cellpadding="5"
+        // style="font-family: sans-serif; border-top:1px solid #dddddd;
+        // What will not work is style with comma inside, e. g.
+        // style="font-family: Verdana, Arial, Helvetica, sans-serif"
         $attr_chunks = preg_split("/\s*,\s*/", strtolower($line));
         $options = array();
         foreach ($attr_chunks as $attr_pair) {
             if (empty($attr_pair)) continue;
             $key_val = preg_split("/\s*=\s*/", $attr_pair);
             if (!empty($key_val[1]))
-                $options[trim($key_val[0])] = trim($key_val[1]);
+                $options[trim($key_val[0])] = trim(str_replace("\"", "", $key_val[1]));
         }
         return $options;
     }

--------------030009050607000902020106
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
--------------030009050607000902020106
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Phpwiki-patches mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/phpwiki-patches

--------------030009050607000902020106--