On Aug 15, 2008, at 10:26 AM, Wang Ning wrote:

> Hi Vincent,
>
> On Fri, Aug 15, 2008 at 3:12 PM, Vincent Massol <[EMAIL PROTECTED]>  
> wrote:
>> Hi Wang,
>>
>> On Aug 15, 2008, at 7:05 AM, Wang Ning wrote:
>>
>>> Hi, Vincent
>>>
>>> I test the xhtml parser. There is the focus:
>>> 1. base text format
>>> underline. I think you can fix it.
>>
>> see http://code.google.com/p/wikimodel/issues/detail?id=31
>>
>> Now we need to submit a patch or wait till it's fixed.
>>
> I think I fix it in my machine, but I modify a several class in both
> xwiki-core-rendering and org.wikimodel.wem. The following is my steps:
> for xwiki-core-rendering-api
> 1. add UnderlineBlock in org.xwiki.rendering.block. just like  
> BoldBlock
> 2. add beginUnderline() and endUnderline() in Listener interface.
> 3. implement this two new methods in all the implement classes, etc
> ListenerDelegate, XWikiSyntaxRenderer, XHTMLRenderer

This is already implemented as FormatBlock and begin/endFormat.

> for xwiki-core-rendering-wikimodel
> 1. modify endFormat(WikiFormat format) in XDOMGeneratorListener.java
> add  a else-if for underline format

Yep. You also need to add the underline in XWikiScanner.jj

> for wikimodel
> 1. add public static final WikiStyle UNDERLINE = new WikiStyle("u");
> in IWemConstants.java
> 2. XhtmlHandler need to be add a taghandler for underline in TagStack
>
> I have test it. It works fine. And I think we can add <del> <sup>
> <sub> support in the same way.
> But I found that <u> is deprecated in xhtml.  So, do we need support  
> it?

ah good finding. This is maybe why it's not supported by wikimodel.
Is there any replacement?

> Furthermore, As I just want to fix the xhtml parser in wikimodel and
> WikiModelXHTMLParser so that the xhtml can convert to xdom then to
> xwiki syntax, so I think I just only need to modify the XhtmlHandler
> in wikimodel. I don't understand how XWikiScanner.jj works and I think
> it is for the generation for xwiki syntax to wikimodel, right?

If you don't change it won't work since currently __ is mapped as  
bold. It's only a one line change to fix it.

> Should I submit my patch to wikimodel and xwiki-core-rending?

For wikmodel yes you can submit your patch in the existing issue.
For core rendering you can attach your patches in this issue: 
http://jira.xwiki.org/jira/browse/XWIKI-2568 
  (but do a svn up first since I implemented a few things yesterday).

>>> 2. List
>>> both number and bulleted.
>>> The problem is in wikimodel xhtmlparser. It don't parser nested list
>>> correctly. I think it hard to fix but I will try my best.
>>
>> See http://code.google.com/p/wikimodel/issues/detail?id=22&can=4
>>
>> I need to update our version of wikimodel to latest from wikimodel
>> trunk since I think something related to lists has been fixed. I'll  
>> do
>> that later today.
>>
> I use the latest version fo wikimodel. And as you said in the
> issues-22, list items and lists are closed when they shouldn't.
>
>> Otherwise we need to submit a patch or wait.
>>
> I think this is a little hard for me to fix it, but I will try.

Yes it's not very easy to fix. Mikhail (the main developer of  
wikimodel) is currently on holiday and will be back only in about 10  
days I think.

>>> 3. Link
>>> For input <html><body><a
>>> href=\"http://xwiki.org\";>xwiki</a></body></html>, the xhtmlparser
>>> generate
>>> beginDocument()
>>>   beginParagraph([])
>>>       beginFormat([])
>>> xwiki<http://xwiki.org>        endFormat([])
>>>   endParagraph([])
>>> endDocument()
>>>
>>> I use XhtmlParser and EventDumpListener.
>>> But the WikiModelXHTMLParser don't handle the event. Maybe
>>> XDOMGeneratorListener have some problem to generate link block. Any
>>> suggestion about this? Thanks.
>>
>> Don't know. Would need to look.
>>
>>> 4. table
>>> Xhtmlparser can generate table event, but XDOMGeneratorListener  
>>> don't
>>> handle the event correctly. Is it not finished?
>>
>> Yes tables in xwiki is done using a table macro which is not
>> implemented yet.
>>
>> I'll ask Thomas if that's something he could work on in priority  
>> (he's
>> started the code macro but this is even more important, I had
>> forgotten about it).
>>
>>> 5. img
>>> Xhtmlparser just ignore the <img> tag. But it's OK since I use
>>> imagetagfilter to handle the <img>
>>
>> Then we need to report an issue against the XHTML parser.
> I did it yesterday ;)

ok cool. I thought you had commented to disregard your issue :)

>
>>
>>> 6. param of text
>>> like <p align="center">text</p>. how to handle the algin parameter?
>>
>> I think we should use only "style" parameter and then talk with
>> wikimodel to support it somehow.
>>
>>> I think, if the problem above can be fixed, xhtmlparser will work  
>>> for
>>> conversion from xhtml to xwiki syntax.
>>
> PS: If I add some test case in xwiki-core-rendering-tests for
> underline <del> <sup> <sub> or <img> <link>, how should I submit the
> new testcast to the svn?
> Do I need to create a issue and attach the test case as patch? Or  
> some way else?

Attach to http://jira.xwiki.org/jira/browse/XWIKI-2568. However if the  
code doesn't pass the tests then we won't be able to commit them since  
it would break the build so we need to fix the code so that the tests  
pass before we can commit them.

Check my comments in yesterday svn commit log since I didn't put tests  
for del and underscore for that reason.

Thanks
-Vincent

_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to