On Feb 23, 2009, at 3:23 PM, Asiri Rathnayake wrote:
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.
This is a bug in the XHTML parser. It should generate an embedded
document. This is true for any block element inside a table cell.
However in order to get simpler xwiki syntax we could modify the XWiki
Syntax Renderer to remove the embedded doc in case it contains only a
paragraph.
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.
why?
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? :)
I think so. In addition you haven't fixed the problem in the general
case. For example if someone chooses HTML 4.01 syntax in wiki pages.
Even if the problem was not in the parser/renderer you should still
have moved it in the default HTML cleaner and not in the office
cleaner IMO since I don't see the relationship with office import.
Can you open a jira issue?
Thanks
-Vincent
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