Hi,
On Sun, Jul 26, 2009 at 1:43 PM, Niels Mayer <nielsmayer(a)gmail.com> wrote:
In
http://code.xwiki.org/xwiki/bin/view/Snippets/DisplayFormatedCodeAttachment…
VincentMassol | 2009/05/05 20:03
> Niels, no there's no plan but we can now support any language using
macros
so feel free to provide a clojure macro if
you're interested. Shouldn't
be
too hard to do, especially if there's a
JSR-223 implementation (in which
case simply dropping the jar in WEB-INF/lib should be enough - you'd then
use it using the script macro).
Clojure <http://groups.google.com/group/clojure> has aJSR-223
implementation
according to:
http://github.com/pmf/clojure-jsr223/tree/master
http://groovy.codehaus.org/JSR-223+access+to+other+JVM+languages
http://sayspy.blogspot.com/2009/03/interacting-between-jvm-lang-here-and.ht…
Are there any examples, documentation, or suggestions of writing a "script
macro" to call a new jar in WEB-INF/lib ?
1. Put the Clojure jar
file<http://repo1.maven.org/maven2/org/clojure/clojure/1.0.0/clojure-1.0…
WEB-INF/lib directory
2. Build the Clojure JSR223 engine from
http://github.com/pmf/clojure-jsr223/tree/master and place it inside
WEB-INF/lib
3. Restart your xwiki and use the script macro as below:
{{script language="Clojure"}}
// Put your clojure script here.
{{/script}}
(Note that since context is a reserved binding in JSR-223 specifications
used for Scripting Macros, the XWiki Api Context is now accessible throught
xcontext.)
I haven't myself tried out clojure inside xwiki but I built a ruby
macro<http://code.xwiki.org/xwiki/bin/view/Macros/RubyMacro>(for
2.0M2) just by following the steps I described to you :)
Enjoy!
- Asiri