[xwiki-users] How to create a macro ?

BOUSQUET Jeremie Jeremie.BOUSQUET at gemalto.com
Wed May 9 11:45:32 CEST 2007


Hello all,
 
Sorry, Vincent Massol already answered with the new possibility of referencing the macro page in administration part.
 
I confirm : it works !
 
Thanks,
 
Jérémie


________________________________

	From: BOUSQUET Jeremie [mailto:Jeremie.BOUSQUET at gemalto.com] 
	Sent: jeudi 3 mai 2007 10:50
	To: xwiki-users at objectweb.org
	Subject: RE: [xwiki-users] How to create a macro ?
	
	
	Hello,
	 
	I applied exactly the solution proposed by Brian in my Wiki (see his answer below) : create macros in a specific wiki document, import it with an #includeMacros macro located inside the "View" field of my skin, like this:
	###
	### Main "view" template
	###
	### General wrapper for view actions
	###
	[.......]
	</div>## main
	#template("endpage.vm")
	#includeMacros('XWiki.MyMacros')
	#end
	 
	My problem is that the macro includeMacros adds {pre} / {/pre} tags that get rendered, and so appear in all pages. I cannot put them inside the "content" of the page, because I would have to overload the "contentview.vm" file, in which is declared the "xwikicontent" div.
	 
	How can I get rid of those {pre} {/pre} tags ?  I would like to avoid overloading the "contentview.vm" because I think it's not a good thing to do (it's not in the default templates, but in the skins) ... 
	 
	Thanks,
	 
	Jérémie


________________________________

		From: THOMAS, BRIAN M (ATTSI) [mailto:bt0008 at att.com] 
		Sent: mercredi 25 avril 2007 18:58
		To: xwiki-users at objectweb.org
		Subject: RE: [xwiki-users] How to create a macro ?
		
		
		To expand on Thomas's second option, you can actually put either the macro definition or a directive including the document containing it into the view template of your skin (to make it global as you desired).  This can be done either by modifying /templates/view.vm or the "view" field of your skin (which, if non-empty, will override view.vm).
		 
		And to clarify his reply slightly, the original macros.vm is actually in the /templates directory.  If you wish your macro to be global, regardless of the skin, I think you will want to edit that one instead of the one in your skin directory.  This is apparently a change from the pre-1.0 days, when the skins directories didn't contain template files - I presume that they are now copied there from /templates when a skin is created.
		 
		Vincent (or anybody), can you confirm this?  Are these files actually copied whenever a skin is created, or only when a custom version of the file's content is desired?
		 
		Also, as Vincent mentions in an intervening reply, you can load macros from an XWiki document rather than from a file, using the #includeMacros macro (which, in 0.9.8
		 
		 
		brain[sic] 
		 
		
		

________________________________

			From: Thomas Kliethermes [mailto:kliether at us.ibm.com] 
			Sent: Wednesday, April 25, 2007 10:02 AM
			To: xwiki-users at objectweb.org
			Subject: Re: [xwiki-users] How to create a macro ?
			
			

			From what I understand, there's two ways to do it.  One, add it to macros.vm in your skin directory.  Two, put it in a .vm file you include in the document you need to use it in (using #template("filename.vm")).  Anyone know if there any better ways? 
			
			-Tom
			
			--
			Tom Kliethermes
			eSupport Initiatives
			IBM Information Management
			(913) 599-7240   Fax: (913) 599-8590
			http://www.ibm.com/software/data
			
			
			
			
roopesh at digitalglue.in 

04/25/2007 02:19 AM 
Please respond to
xwiki-users at objectweb.org


To
xwiki-users at objectweb.org 
cc
Subject
[xwiki-users] How to create a macro ?	

		




			Hi
			
			How can I create my own macro in my xwiki (say, a macro for adding two numbers). Where should I write it. So that I can use it from any page ?
			
			Regards
			Roopesh
			
			
			--
			You receive this message as a subscriber of the xwiki-users at objectweb.org mailing list.
			To unsubscribe: mailto:xwiki-users-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
			
			

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xwiki.org/pipermail/users/attachments/20070509/84aa9754/attachment-0001.html 


More information about the users mailing list