Description
If a table has more than one wiki-like markup option, like tableclass and tablestyle together within <...>, then it messes up the parsing of the table.
The wiki-like markup includes the words style rowstyle tablestyle class rowclass tableclass id. If any two of these words appear in one <...>, none of the style applies. Examples are given below. Note that this did not happen under 1.3.5; I've used 1.5RC4, 1.5.0 and 1.5.1 and all of them give the same buggy behaviour.
Steps to reproduce
Create a table with <tablestyle="float:right;" tableclass="myclass"> and the only styling it gets is class="float:right;".
Example
The first 2 tables below are styled correctly, the last one should have an aqua background and class "foobar" but doesn't.
Table with class
Wiki markup {{{||<tableclass="foobar"> Table with class || Two || ||class="foobar"||Four||}}} produces HTML (I've fiddled with the whitespace) {{{<table class="foobar"> <tr><td><p> Table with class </p></td>
<td><p> Two </p></td></tr>
<span id="line-16" class="anchor"></span> <tr><td><p>class="foobar"</p></td> <td><p>Four</p></td></tr> <span id="line-17" class="anchor"></span></table>}}}
On this wiki, the output is
Table with class |
Two |
class="foobar" |
Four |
At the time of writing this, the output was
Table with style
Wiki markup {{{||<tablestyle="background-color: aqua;">Table with style||Two|| ||style="background-color: aqua;"||Four||}}} produces HTML {{{<table style="background-color: aqua;"> <tr><td><p>Table with style</p></td> <td><p>Two</p></td></tr> <span id="line-19" class="anchor"></span><tr> <td><p>style="background-color: aqua;"</p></td> <td><p>Four</p></td></tr> <span id="line-20" class="anchor"></span></table>}}}
On this wiki, the output is
Table with style |
Two |
style="background-color: aqua;" |
Four |
At the time of writing this, the output was
Table with class and style
{{{||<tableclass="foobar" tablestyle="background-color: aqua;"> Style and class || Two || ||as above||Four||}}} produces HTML {{{<table class="background-color: aqua;"> <tr><td><p> Style and class </p></td> <td><p> Two </p></td></tr> <span id="line-22" class="anchor"></span><tr> <td><p>as above</p></td> <td><p>Four</p></td></tr> <span id="line-23" class="anchor"></span></table>}}}
On this wiki, the output is
Style and class |
Two |
as above |
Four |
At the time of writing this, the output was
Details
This Wiki.
Workaround
Only solution is to rewrite all your tables.
No. Parsing of table attributes was broken by patch submitted as fix to MoinMoinBugs/TableHtmlKeywordsNotParsed. Real solution to that and this bug would be:
wiki.py.patch committed to moin--main--1.5--patch-4081 --- parser/wiki.py.orig 2006-01-28 08:41:27.000000000 +0300 2 +++ parser/wiki.py 2006-01-28 09:28:34.000000000 +0300 3 @@ -672,12 +672,8 @@ 4 'arg': arg, 'key': key} 5 else: 6 attrs['bgcolor'] = '"#%s"' % arg 7 - elif key == '=': 8 - arg = parser.get_token() 9 - this_key = attrdef.split('=')[0] 10 - attrs[this_key] = arg 11 else: 12 - msg = "" 13 + msg = None 14 #print "key: %s\nattrs: %s" % (key, str(attrs)) 15 return self.formatter.rawHTML(msg)
(attrdef.split('=')[0] always gets first and only attribute from attrdef so in effect resulting html-element receives single attribute with a name of first and value of last attribute from the source attribute sequence.
table_extension() just need to leave entire name=value pair to parseAttributes() when none of its special cases applyes to a given token -- it must return None)
{{{||<tableclass="foobar" tablestyle="background-color: aqua;"> Style and class || Two ||
||as above||Four||}}}
- would produce HTML
<table style="background-color: aqua;" class="foobar"> <tr><td><p> Style and class </p></td><td><p> Two </p></td></tr> <span id="line-9" class="anchor"></span> <tr><td><p>as above</p></td><td><p>Four</p></td></tr> <span id="line-10" class="anchor"></span> </table>
Discussion
This is a much nicer patch -- ReimarBauer 2006-01-28 09:35:06
Worked for me. Walter Gildersleeve 2006-01-28
Plan
- Priority:
- Assigned to:
- Status: committed to moin--main--1.5--patch-408