[xwiki-users] Can't make a groovy macro work
Hello, I'm writing a macro extension in groovy. I need to use services rendiring.parse () and i get an exception every time I try to use it. Can anyone give a good example as to how to use it in a groovy script ? Thanks! Dan. -- View this message in context: http://xwiki.475771.n2.nabble.com/Can-t-make-a-groovy-macro-work-tp7599001.h... Sent from the XWiki- Users mailing list archive at Nabble.com.
On 15 Apr 2016, at 05:32, dullfig <[email protected]> wrote:
Hello, I'm writing a macro extension in groovy. I need to use services rendiring.parse () and i get an exception every time I try to use it. Can anyone give a good example as to how to use it in a groovy script ? Thanks!
See http://extensions.xwiki.org/xwiki/bin/view/Extension/Rendering+Module#HRende... To help you more we’d need to see your content and the error you get. Thanks -Vincent
Dan.
-- View this message in context: http://xwiki.475771.n2.nabble.com/Can-t-make-a-groovy-macro-work-tp7599001.h...
here is the code I'm working on; it's in a page called PlantUMLMacroGClass; I'm modifying plantuml to output svg instead of png so it is clickable and can contain links. It already is clickable, but the links of course are broken, so now I want to preprocess the uml definition to translate page links to url's using parse and render. String run( request, response) { // Using umlref, each diagram of the wiki page has its own unique url def umlref="1" if (null != ctx.umlref) { umlref=Integer.toString(Integer.valueOf(ctx.umlref)+1) } ctx.put("umlref", umlref) response.setContentType("image/svg+xml") // translate all page links to url's def translated = services.rendering.render( services.rendering.parse( umltext, "xwiki/2.1" ), "xhtml/1.0" ) def reader = new SourceStringReader("@startuml\n"+translated+"\n@enduml") def os = new ByteArrayOutputStream() def option = new FileFormatOption( FileFormat.SVG ) def desc = reader.generateImage(os, option) os.close() return "{{html wiki=\"true\"}}" + os + "{{/html}}" } It throws an exception with a long long traceback, seems to complain of non-existing feature. commenting out the line with the rendering call makes it work. Dan -----Original Message----- From: Vincent Massol Sent: Thursday, April 14, 2016 11:24 PM To: XWiki Users Subject: Re: [xwiki-users] Can't make a groovy macro work
On 15 Apr 2016, at 05:32, dullfig <[email protected]> wrote:
Hello, I'm writing a macro extension in groovy. I need to use services rendiring.parse () and i get an exception every time I try to use it. Can anyone give a good example as to how to use it in a groovy script ? Thanks!
See http://extensions.xwiki.org/xwiki/bin/view/Extension/Rendering+Module#HRende... To help you more we’d need to see your content and the error you get. Thanks -Vincent
Dan.
-- View this message in context: http://xwiki.475771.n2.nabble.com/Can-t-make-a-groovy-macro-work-tp7599001.h...
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
still can’t help you without the error… -Vincent
On 15 Apr 2016, at 18:55, Daniel Ullfig <[email protected]> wrote:
here is the code I'm working on; it's in a page called PlantUMLMacroGClass; I'm modifying plantuml to output svg instead of png so it is clickable and can contain links. It already is clickable, but the links of course are broken, so now I want to preprocess the uml definition to translate page links to url's using parse and render.
String run( request, response) { // Using umlref, each diagram of the wiki page has its own unique url def umlref="1" if (null != ctx.umlref) { umlref=Integer.toString(Integer.valueOf(ctx.umlref)+1) } ctx.put("umlref", umlref) response.setContentType("image/svg+xml") // translate all page links to url's def translated = services.rendering.render( services.rendering.parse( umltext, "xwiki/2.1" ), "xhtml/1.0" ) def reader = new SourceStringReader("@startuml\n"+translated+"\n@enduml") def os = new ByteArrayOutputStream() def option = new FileFormatOption( FileFormat.SVG ) def desc = reader.generateImage(os, option) os.close()
return "{{html wiki=\"true\"}}" + os + "{{/html}}"
}
It throws an exception with a long long traceback, seems to complain of non-existing feature. commenting out the line with the rendering call makes it work.
Dan
-----Original Message----- From: Vincent Massol Sent: Thursday, April 14, 2016 11:24 PM To: XWiki Users Subject: Re: [xwiki-users] Can't make a groovy macro work
On 15 Apr 2016, at 05:32, dullfig <[email protected]> wrote:
Hello, I'm writing a macro extension in groovy. I need to use services rendiring.parse () and i get an exception every time I try to use it. Can anyone give a good example as to how to use it in a groovy script ? Thanks!
See http://extensions.xwiki.org/xwiki/bin/view/Extension/Rendering+Module#HRende...
To help you more we’d need to see your content and the error you get.
Thanks -Vincent
Dan.
-- View this message in context: http://xwiki.475771.n2.nabble.com/Can-t-make-a-groovy-macro-work-tp7599001.h...
participants (3)
-
Daniel Ullfig -
dullfig -
Vincent Massol