vmassol wrote:
>
> Hi Bogdan,
>
> On Feb 15, 2011, at 2:41 PM, Bogdan Flueras wrote:
>
>> Hello devs,
>> I'm working on some project outside XWiki which uses your rendering API.
>> Managed to wire everything and to define my custom macro, wrote some unit
>> tests but when I use another wiki dialect except XWIKI_2_0 (for instance
>> Creole) in the Converter, my macro is not recognized.
>> See sample code below:
>>
>> // Initialize Rendering components and allow getting instances
>> ecm = new EmbeddableComponentManager();
>> ecm.initialize(this.getClass().getClassLoader());
>> Converter converter = ecm.lookup(Converter.class);
>>
>> //Register my special custom macros
>> ComponentAnnotationLoader loader = new ComponentAnnotationLoader();
>> List<ComponentDescriptor> compDescriptors =
>> loader.getComponentsDescriptors(MySpecialMacro.class);
>> ecm.registerComponent(compDescriptors.get(0));
>>
>> Converter converter = ecm.lookup(Converter.class);
>> WikiPrinter printer = new DefaultWikiPrinter();
>> // HERE IS THE PROBLEM WITH MY CUSTOM MACRO
>> converter.convert(new StringReader("{{link path='foo'}}"),
>> Syntax.CREOLE_1_0, Syntax.XHTML_1_0, printer);
>>
>> So my problem is that I'd like to instruct the Creole parser or any other
>> parser except XWIKI_2 to correctly parse my custom macro.
>> I might be wrong, but I guess I'll have to implement some new parser to
>> suit
>> my needs. In respect to that I've dug into the Converter class, saw it's
>> instantiation strategy, then followed the story until I've encountered
>> IWikiParser and all its subclasses (XWikiParser, CreoleParser etc ) which
>> I'm unable to find on the repository.
>
> Indeed you'd need to check if the wikimodel's creole parser supports
> macros.
> The source code is here:
> http://code.google.com/p/wikimodel/
>
> The Creole grammar is here:
> http://code.google.com/p/wikimodel/source/browse/trunk/org.wikimodel.wem/src/main/java/org/wikimodel/wem/creole/javacc/CreoleWikiScanner.jj
>
> As you can see there, it doesn't support macros and thus is not going to
> send an begin/endMacro events to XWiki's listeners.
>
> If you really want to use the Creole syntax you'd need to provide a patch
> for the wikimodel project.
> However why do you need Creole and can't you use XWiki Syntax 2.0 instead?
> XWiki Syntax 2.0 is based on Creole (it's a superset).
>
> Thanks
> -Vincent
>
>> Could you please point me in the right direction?
>>
>> Thank you
>> --
>> ing. Bogdan Flueras
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs
>
>
Yes, using Xwiki syntax seems fine to me.
Again,
thank you Vincent for your help!
--
View this message in context:
http://xwiki.475771.n2.nabble.com/How-to-instruct-a-wiki-parser-to-render-my-custom-macro-tp6027983p6028330.html
Sent from the XWiki- Dev mailing list archive at Nabble.com.
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs