Revision: 2466
http://vexi.svn.sourceforge.net/vexi/?rev=2466&view=rev
Author: mkpg2
Date: 2007-10-15 05:36:53 -0700 (Mon, 15 Oct 2007)
Log Message:
-----------
Test. A slightly different way to create a template from a string.
Modified Paths:
--------------
trunk/core/org.vexi.core/src/org/vexi/core/Resources.java
trunk/core/org.vexi.core/src/org/vexi/core/Vexi.jpp
Added Paths:
-----------
trunk/core/org.vexi.core/src_junit/test/core/template/parse2.t
Modified: trunk/core/org.vexi.core/src/org/vexi/core/Resources.java
===================================================================
--- trunk/core/org.vexi.core/src/org/vexi/core/Resources.java 2007-10-15
03:21:45 UTC (rev 2465)
+++ trunk/core/org.vexi.core/src/org/vexi/core/Resources.java 2007-10-15
12:36:53 UTC (rev 2466)
@@ -99,11 +99,11 @@
// TODO - move to constructor of Fountain.Multiple
- public static JS combine(final JS[] streams) throws JSExn{
- if(streams.length==0) return null;
+ public static JS multiple(final JS[] streams) throws JSExn{
+ /*if(streams.length==0) return null;
if(streams.length==1){
return streams[0];
- }else{
+ }else{*/
try{
// REMARK - ignoring non-cacheable (i.e. fountains
which aren't some
// sort of directory) when more than one arg given.
@@ -119,7 +119,7 @@
}catch(Exception e){
throw new JSExn(e.getMessage());
}
- }
+ //}
}
Modified: trunk/core/org.vexi.core/src/org/vexi/core/Vexi.jpp
===================================================================
--- trunk/core/org.vexi.core/src/org/vexi/core/Vexi.jpp 2007-10-15 03:21:45 UTC
(rev 2465)
+++ trunk/core/org.vexi.core/src/org/vexi/core/Vexi.jpp 2007-10-15 12:36:53 UTC
(rev 2466)
@@ -110,7 +110,7 @@
case "regexp": return METHOD;
case "stream": return getSub(name);
case "stream.cache": return METHOD;
- case "stream.combine": return METHOD;
+ case "stream.multiple": return METHOD;
case "stream.fromString": return METHOD;
case "stream.homedir": return Resources.fountainForURL("file:" +
System.getProperty("user.home"));
case "stream.tempdir": return Resources.fountainForURL("file:" +
System.getProperty("java.io.tempdir"));
@@ -199,7 +199,7 @@
case "log.warn": if(args.length<1) JSU.warn(null); else
JSU.warn(args[0]); return null;
case "log.error": if(args.length<1) JSU.error(null); else
JSU.error(args[0]); return null;
case "net.rpc.soap": return new SOAP(JSU.toString(args[0]),
JSU.toString(args[1]), JSU.toString(args[2]));
- case "stream.combine": return Resources.combine(args);
+ case "stream.multiple": return Resources.multiple(args);
//#end
switch (args.length) {
Added: trunk/core/org.vexi.core/src_junit/test/core/template/parse2.t
===================================================================
--- trunk/core/org.vexi.core/src_junit/test/core/template/parse2.t
(rev 0)
+++ trunk/core/org.vexi.core/src_junit/test/core/template/parse2.t
2007-10-15 12:36:53 UTC (rev 2466)
@@ -0,0 +1,33 @@
+<vexi xmlns:ui="vexi://ui" xmlns="">
+
+
+ <ui:box>
+
+ var tString =
+ ["<vexi xmlns:ui='vexi://ui'>",
+ "static.a=1; ",
+ "static.ex++=function(){try{throw \"\";}catch(e){return e;}}",
+ " <ui:box b='z'/></vexi>"].join("\n");
+
+ /* A second way to parse a template from a string. Instead of
+ giving it a name in the blessing, add it as a stream to a parent
+ stream, bless the parent and it will derive its name from the
+ trapname */
+
+ var tStream = vexi.stream.fromString(tString);
+ var pStream = vexi.stream.multiple();
+ pStream["mytemplate.t"] ++= tStream;
+
+ vexi.thread = function(){
+ var pBlessing = vexi.bless(pStream);
+ var t = pBlessing.mytemplate;
+ .util..assertEquals(1,t..a);
+ var b = t(vexi.box);
+ .util..assertEquals("z",b.b);
+ var e = t..ex;
+ .util..assertEquals("mytemplate:3",e.backtrace[0]);
+ };
+
+ </ui:box>
+
+</vexi>
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Vexi-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/vexi-svn