[xwiki-dev] How to create own tags in xwiki?

kinslayer kinslayer at centrum.cz
Mon May 7 16:54:41 CEST 2007


I have already found solution. 
I am really fool. It was so easy.



kinslayer wrote:
> 
> Hi,
> 
> your answers was really very useful and I have created some new tags
> with Radeox.
> But I have other problem now.
> 
> I need to print list of attachments (only current document) in my radeox
> macro.
> 
> I tried combine radeox macro and standard XWikiPluginInterface, but it
> didn't work.
> I wrote something like this:
> 
> public void execute(Writer writer, MacroParameter params)
> throws IllegalArgumentException, IOException 
> {
>    ...
> // attachment.print() is metod, which print returns some String and is
> created in attachmentPluginApi
> str.append("$xwiki.attachment.print()"); 
> writer.write(str.toString());     
>    ...
> }
> 
> 
> This my solution really print only text "$xwiki.attachment.print()".
> 
> XWikiPlugin I created some way like is writen in:
> http://www.xwiki.org/xwiki/bin/view/DevGuide/CreatingPlugins
> 
> and syntax $xwiki.attachment.print() work in wiki document, but it doesn't 
> work in my radeox macro.
> 
> Is it some solution of this problem?
> 
> - Honza
> 
> 
> 
> hritcu wrote:
>> 
>> On 4/3/07, kinslayer <kinslayer at centrum.cz> wrote:
>>>
>>> Hi,
>>>
>>> thank you for your answer. I've already looked to links you sent
>>> and so you thing the best way to create own tags is Radeox Macros?
>>>
>> Your question gave me the impression you want to use Radeox syntax. I
>> don't really know whether this is the best option to extend the xwiki
>> syntax. What do the others think? What are the current alternatives?
>> Would Velocity be better suited for this scenario?
>> 
>>> Unfortunately I still don't see, where is the part, where I can render
>>> syntax of wiki and find my new tags in this text?
>>>
>> You don't parse the Radeox syntax yourself. Radeox does this and
>> delivers the result to the appropriate macro in the form of a
>> MacroParameter object, which despite it's name contains the values of
>> ALL parameters of your macro invocation.
>> 
>>> For Example SVGMacro:
>>> If I grasp the significance SVGMacro well. Syntax of this tag
>>> is {svg:image|height|width}.
>> Yes. And this is the code that reads the values of these parameters
>> 
>>         /* {svg:image|height|width} */
>>         StringBuffer str = new StringBuffer();
>>         String text = params.get("text", 0);
>>         String height = params.get("height", 1);
>>         if ((height==null)||("none".equals(height))) {
>>         	height = "400";
>>         }
>>         String width = params.get("width", 2);
>> 
>> and then uses them to generate the appropriate markup. This is the way
>> this extension mechanism is supposed to work.
>> 
>>> But I still can not see, where is this
>>> syntax checked?Can you write me which part or method do this?
>>>
>> The syntax is checked by Radeox internally. If you need to change how
>> Radeox works internally in order to implement your extension, then I
>> don't think this is the best to extend in the first place.
>> 
>>> My idea is to create some tags for our municipal office.
>>> For example:
>>> We need some tag, for example {munboard} with this syntax
>>> {muboard:$message:$datetime}, where $message is text, which
>>> shouldn't  be displayed when $datetime timeout.
>>>
>> I don't see any reason why you can't just test the value of the
>> datetime parameter in your Macro. Depending on it's value (after some
>> more parsing probably) you could decide to generate some markup
>> containing the message, or no markup at all in case the timeout has
>> expired. Once again, there might be ways other than Radeox Macros to
>> do this, but I don't see why this wouldn't be really simple should you
>> want to use Radeox.
>> 
>>> In the end I like to say thank you very much for your help
>>> and sorry for my bad English. :-)
>>>
>> 
>> Regards,
>> Catalin
>> 
>>> hritcu wrote:
>>> >
>>> > Hi,
>>> >
>>> > Please have a look at the Custom Syntax with Radeox Macros section
>>> > from this post:
>>> > http://hritcu.wordpress.com/2007/03/13/xwiki-plugins-tips-and-tricks/
>>> >
>>> > For more examples have a look at the source code of existing plugins:
>>> >
>>> http://svn.forge.objectweb.org/cgi-bin/viewcvs.cgi/xwiki/xwiki/trunk/core/src/main/java/com/xpn/xwiki/plugin/svg/SVGMacro.java?view=markup&rev=1387
>>> > or
>>> >
>>> http://svn.forge.objectweb.org/cgi-bin/viewcvs.cgi/xwiki/xwiki/trunk/core/src/main/java/com/xpn/xwiki/plugin/charts/ChartingMacro.java?view=markup&rev=1387
>>> >
>>> > If you still have more questions please ask them here.
>>> >
>>> > Regards,
>>> > Catalin
>>> >
>>> >
>>> > On 4/2/07, kinslayer <kinslayer at centrum.cz> wrote:
>>> >>
>>> >> Hi,
>>> >>
>>> >> I don't understand how to create plugin with my own tags in xwiki.
>>> >> I would like to create some tags - something like {table} ....
>>> {table},
>>> >> but I don't know how to render xwiki text with plugin.
>>> >>
>>> >> Can anybody help me?
>>> >>
>>> >> In fact is it even possible to write this plugin with
>>> >> XWikiDefaultPlugin/XWikiPluginInterface?
>>> >>
>>> >> It would be great if somebody be able to publish plugin which
>>> >> implementing
>>> >> new tags
>>> >> or write me the instruction what I have to do.
>>> >>
>>> >> Thank you.
>>> >>
>>> >>
>>> >>
>>> >>
>>> >> --
>>> >> View this message in context:
>>> >>
>>> http://www.nabble.com/How-to-create-own-tags-in-xwiki--tf3504145.html#a9786314
>>> >> Sent from the XWiki- Dev mailing list archive at Nabble.com.
>>> >>
>>> >>
>>> >>
>>> >>
>>> >> --
>>> >> You receive this message as a subscriber of the
>>> xwiki-dev at objectweb.org
>>> >> mailing list.
>>> >> To unsubscribe: mailto:xwiki-dev-unsubscribe at objectweb.org
>>> >> For general help: mailto:sympa at objectweb.org?subject=help
>>> >> ObjectWeb mailing lists service home page:
>>> http://www.objectweb.org/wws
>>> >>
>>> >>
>>> >
>>> >
>>> >
>>> > --
>>> > You receive this message as a subscriber of the
>>> xwiki-dev at objectweb.org
>>> > mailing list.
>>> > To unsubscribe: mailto:xwiki-dev-unsubscribe at objectweb.org
>>> > For general help: mailto:sympa at objectweb.org?subject=help
>>> > ObjectWeb mailing lists service home page:
>>> http://www.objectweb.org/wws
>>> >
>>> >
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/How-to-create-own-tags-in-xwiki--tf3504145.html#a9806702
>>> Sent from the XWiki- Dev mailing list archive at Nabble.com.
>>>
>>>
>>>
>>>
>>> --
>>> You receive this message as a subscriber of the xwiki-dev at objectweb.org
>>> mailing list.
>>> To unsubscribe: mailto:xwiki-dev-unsubscribe at objectweb.org
>>> For general help: mailto:sympa at objectweb.org?subject=help
>>> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>>>
>>>
>> 
>> 
>> 
>> --
>> You receive this message as a subscriber of the xwiki-dev at objectweb.org
>> mailing list.
>> To unsubscribe: mailto:xwiki-dev-unsubscribe at objectweb.org
>> For general help: mailto:sympa at objectweb.org?subject=help
>> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-create-own-tags-in-xwiki--tf3504145.html#a10358790
Sent from the XWiki- Dev mailing list archive at Nabble.com.





More information about the devs mailing list