Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
XWiki Rendering Framework Grails Integration
Java Groovy Shell
tag: 0.2

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
grails-app
scripts
src/java/com/monochromeroad/grails/plugins/xwiki
test
web-app/WEB-INF
.gitignore
LICENSE.txt
README.md
XwikiRenderingGrailsPlugin.groovy
application.properties

README.md

XWiki Rendering Framework Grails Integration

This Grails plugin allows you to convert texts using XWiki Rendering Framework.

XWiki Rendering Framework

Upgrading from version 0.1

Removal of TagLib "xwikiRender"

Use "<xwiki:render inputSyntax='' />" tag instead.

Removal of Service "RenderingService"

Use "XWikiRenderer" service instead.

Installation

Just run "install-plugin" command.

grails install-plugin xwiki-rendering

Tag Libraries

This Plugin provides "<xwiki:render inputSyntax='' outputSyntax='' />" tag.

inputSyntax:

outputSyntax:

Example

<xwiki:render inputSyntax="xwiki/2.1" outputSyntax="xhtml/1.0">
= level1 headings =
** bold text **
</xwiki:render>

See also XWiki Syntax for the xwiki/2.0 syntax basics

Services

This Plugin provides "xwikiRenderer" as a Grails Service. you can inject it like this.

def xwikiRenderer

This service has "render(sourceText, inputSyntax, outputSyntax)" and "render(reader, writer, inputSyntax, outputSyntax)" method.

class SomeController {

    def xwikiRenderer

    def someAction = {
        String testString = """
        =level1=
        **bold**
        """
        String result = xwikiRenderer.render(textString, "mediawiki/1.0", "plain/1.0")

        ...
    }

}

or

class SomeController {

    def xwikiRenderer

    def someAction = {
        StringWriter writer = new StringWriter()
        new File("./test").withReader { reader ->
            xwikiRenderer.render(reader, writer, "mediawiki/1.0", "plain/1.0")
        }
        String result = writer.toString()

        ...
    }

}

Using Macros

The Macro libraries must be added to your grails project in order to use XWiki Macros.

If you want to create your own macro, ExtendingMacro would be useful.

Example

If you need Comment Macro :

grails-app/conf/BuildConfig.groovy

dependencies {
    ...
    runtime("org.xwiki.rendering:xwiki-rendering-macro-comment:3.2") {
        transitive = false
    }
}

and:

<xwiki:render inputSyntax="xwiki/2.1" outputSyntax="xhtml/1.0">
= level1 headings =
** bold text **
{{comment}}
comment here...(not be rendered)
{{/comment}}
</xwiki:render>
Something went wrong with that request. Please try again.