3 XWiki Macro - Reference Documentation
Authors: Masatoshi Hayashi
Version: 1.0-RC2
3 XWiki Macro
You can use some XWiki macros to extend the wiki syntax.<xwiki:render> = Comment Macro DEMO = {{comment}} comment here...(not be rendered) {{/comment}} </xwiki:render>
- Adding a configuration in BuildConfig.groovy in order to use XWiki official macros. See Configuration for the details.
- Adding a library jar file of the XWiki Macro to your application (that is, edit "BuildConfig.groovy" or add a jar file to
lib
directory). - Adding a macro code to
grails-app/xwiki
directory in your application.
When you create your own macro, ExtendingMacro would be useful.
3.1 Adding XWiki macro libraries
Edit "BuildConfig.groovy" or add a jar file tolib
directory to add a dependency to the macro.grails-app/conf/BuildConfig.groovy
dependencies {
…
compile("com.example:xwiki-macro-xxx:xxx") // a macro jar
}
YOUR-GRAILS-PROJECT/lib
directory.
3.2 Adding XWiki macro codes
Add a groovy class that extends DefaultXWikiMacro or DefaultXWikiNoParameterMacro tograils-app/xwiki
directory in the grails project.You need to create the class with a nullary constructor.Check out the sample macro code for more details.
If you add the codes to grails-app/xwiki
in your project, the macros can be used in this way:<xwiki:render> = Date Macro DEMO = {{date /}} </xwiki:render>
<xwiki:render> = Code Macro DEMO = {{code mode="java"}} class TestClass {} {{/code}} </xwiki:render>