This discussion has been refactored here from Ideas. It concerns the development of a script plugin to allow complicated operations within WikiPages.


Jan 15, 2003 : Macro/Script language:#

Combined with raw html - now available - a macro/script language would eliminate the need to write in java, compile and deploy, many future plug-ins.

Example:

  • read the unit tests results from a text file, and insert a red/green bar chart
Transform
  
    file: results.txt
    line 1:"2002-12-22","12h20",75,15,0);
into
   <table>
      <tr>
         <td border=1 bgcolor=green width=80>60</td>
         <td border=1 bgcolor=red width=20>15</td>
         <td border=1 width=80>2002-12-22, 12h20</td>
   </tr>
</table>

JRuby or Jython could be the simplest way.

Rhino (javascript) ? -- PhilipVanBogaert

Nooooooooooo..... --JanneJalkanen, who is not prepared to deal with a scripting language...

Actually, you could easily write a WikiPlugin for your favourite language, and use

[{Python compileroptions='-O -cool -wicked'

Diddlydoo := something
}]

Okay, okay, ..
I'll stick to JavaScript, if only JSPWiki could avoid transforming text between the <script> tags : currently, we can't use the JSPWiki syntax special characters (']', two simple quotes, etc... ) and all the camelcased words, - ex. filechar = FileReader.read(); - are also "recognized"
That's would be lot easier, isn't it?

<script language="Javascript">
   document.write('<table><tr>');
   document.write('<td border=1 bgcolor=green width=80>60</td>');
   document.write('<td border=1 bgcolor=red width=20>15</td>');
   document.write('</tr></table>');
</script>
--AlainRavet

Why not write a (relatively) trivial VerbatimPlugin or JavascriptPlugin? We would no longer stop at ']', but at '}]'.

--JanneJalkanen


How about embedding groovy to provide plugin scripting?

Groovy is a new agile dynamic language for the JVM combining lots of great features from languages like Python, Ruby and Smalltalk and making them available to the Java developers using a Java-like syntax.

Groovy is designed to help you get things done on the Java platform in a quicker, more concise and fun way - bringing the power of Python and Ruby inside the Java platform.

Groovy can be used as an alternative compiler to javac to generate standard Java bytecode to be used by any Java project or it can be used dynamically as an alternative language such as for scripting Java objects, templating or writing unit test cases.

http://groovy.codehaus.org/ Groovy Tutorial


I actually needed to do some debugging and quick checks on things and already had an embedded Groovy console and interpreter within my application, so I've simplified that and stuck it into a plugin framework, see GroovyPlugin for details. -- MurrayAltheim

Category Ideas

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-8) was last changed on 10-Sep-2009 23:35 by 89.233.187.148