HI Vincent,
Currently officeimporter test methods are bit messed and I'm going to
refactor / restructure them asap.
Why is this only for th and not for td cells too?
It's tested, inside the test method testTableFiltering() which tests for
several scenarios. This will be corrected with the new restructuring.
Is this specific to the office importer? It looks very generic to me,
isn't it?
Why do paragraphs need to be removed?
Ok, this is something I'm bit confused about.
Consider the following xhtml input:
<code>
<table><thead><tr><th><p>Test</p></th></tr></thead><tbody><tr><td/></tr></tbody></table>
</code>
This xhtml fragment when parsed by xhtml parser and rendered into xwiki 2.0
generates the xwiki 2.0 code below:
<code>
|=
Test
|
</code>
which obviously results in a fragmented table when rendered.
Now that you asked about it, I might have been working myself around a
possible bug in rendering. But these are what I saw as solutions:
1. Wrap the paragraph inside <div class="xwiki-document"> : This results
in
enlarged table header elements.
2. Remove the paragraph if it's an isolated one (only one paragraph inside
the 'th' element) if there are more than one paragraph or other elements
(like lists), then wrap the content within the 'th' element inside a <div
class="xwiki-document">
I've been using the second approach because it yielded the best results so
far... Now, have i been working around a bug which should be fixed in
rendering? :)
What if there are 2 paragraphs elements? what happens? Do you have a
test for that too?
Yes, it's missing a test case for that scenario and several other scenarios,
I will add more tests cases when the test classes are refactored (very soon,
within this week).
Thanks.
- Asiri