On Aug 21, 2011, at 2:53 PM, chakib dohsset wrote:

> Ok, I followed the instructions in this site and I had a problem, here
> is my code
> :
> 
> {{groovy}}
> 
> import org.xwiki.rendering.converter.Converter;
> import org.xwiki.rendering.renderer.printer.DefaultWikiPrinter;
> import org.xwiki.component.manager.ComponentManager;
> 
> @Requirement
> private ComponentManager componentManager;

> // Use the Converter component to convert between one syntax to another.
> Converter converter = componentManager.lookup(Converter.class);
> //Converter converter = services.Converter;

This is not correct. This would be good for a component but you haven't written 
a component here :)

Instead replace the 5 lines above with this:

Converter converter = com.xpn.xwiki.web.Utils.getComponent(Converter.class)

-Vincent

> // Convert input in XWiki Syntax 2.0 into XHTML. The result is stored in the
> printer.
> DefaultWikiPrinter printer = new DefaultWikiPrinter();
> converter.convert(new StringReader("This is **bold**"), Syntax.XWIKI_2_0,
> Syntax.XHTML_1_0, printer);
> 
> //Assert.assertEquals("<p>This is <strong>bold</strong></p>",
> printer.toString());
> print printer.toString();
> {{/groovy}}
> 
> 2011/8/21 Vincent Massol <[email protected]>
> 
>> 
>> On Aug 21, 2011, at 1:19 PM, chakib dohsset wrote:
>> 
>>> in my case i went to do it with velocity or groovy code
>> 
>> Ok, then you need to read this site: http://rendering.xwiki.org and do it
>> with groovy.
>> 
>> Thanks
>> -Vincent
>> 
>>> 2011/8/21 Vincent Massol <[email protected]>
>>> 
>>>> 
>>>> On Aug 21, 2011, at 1:12 PM, chakib dohsset wrote:
>>>> 
>>>>> Hi devs,
>>>>> 
>>>>> I would like to convert xhtml to xwiki/2.0 syntax in wiki mode (groovy
>> or
>>>>> velocity).
>>>> 
>>>> Very easy. Create a page, choose HTML syntax, write content, save. then
>>>> edit page again and select xwiki 2.0 syntax, accept the conversion.
>> Save.
>>>> 
>>>> See also
>>>> 
>> http://platform.xwiki.org/xwiki/bin/view/Features/PageEditing#HChoosingaSyntax
>>>> 
>>>> Thanks
>>>> -Vincent
>> _______________________________________________
>> devs mailing list
>> [email protected]
>> http://lists.xwiki.org/mailman/listinfo/devs
>> 
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs

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

Reply via email to