projects
/
org.ibex.core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rendering optimizations
[org.ibex.core.git]
/
src
/
org
/
ibex
/
Template.java
diff --git
a/src/org/ibex/Template.java
b/src/org/ibex/Template.java
index
2ef5e1b
..
2f3e2ac
100644
(file)
--- a/
src/org/ibex/Template.java
+++ b/
src/org/ibex/Template.java
@@
-34,6
+34,7
@@
public class Template {
Template prev;
Template prev2;
JSScope staticScope = null; ///< the scope in which the static block is executed
Template prev;
Template prev2;
JSScope staticScope = null; ///< the scope in which the static block is executed
+ JS staticObject = null;
// Only used during parsing /////////////////////////////////////////////////////////////////
// Only used during parsing /////////////////////////////////////////////////////////////////
@@
-81,7
+82,7
@@
public class Template {
// FIXME this dollar stuff is all wrong
if (id != null) parentPis.putDollar(id, b);
// FIXME this dollar stuff is all wrong
if (id != null) parentPis.putDollar(id, b);
- PerInstantiationScope pis = new PerInstantiationScope(b, ibex, parentPis, staticScope);
+ PerInstantiationScope pis = new PerInstantiationScope(b, ibex, parentPis, staticObject);
for(int i=0; i<urikeys.length; i++) {
if (urikeys[i] == null) continue;
pis.declare(urikeys[i]);
for(int i=0; i<urikeys.length; i++) {
if (urikeys[i] == null) continue;
pis.declare(urikeys[i]);
@@
-117,7
+118,6
@@
public class Template {
// FIXME: should we be resolving all of these in the XML-parsing code?
}
}
// FIXME: should we be resolving all of these in the XML-parsing code?
}
}
-
b.putAndTriggerTraps(key, val);
}
}
b.putAndTriggerTraps(key, val);
}
}
@@
-163,9
+163,11
@@
public class Template {
if(b.parentkey != null) initial_uri = b.parentkey + (initial_uri.equals("") ? "" : "." + initial_uri);
b = b.parent;
}
if(b.parentkey != null) initial_uri = b.parentkey + (initial_uri.equals("") ? "" : "." + initial_uri);
b = b.parent;
}
+ initial_uri = "";
parse(new InputStreamReader(is));
JS staticScript = parseScript(static_content, static_content_start);
parse(new InputStreamReader(is));
JS staticScript = parseScript(static_content, static_content_start);
- t.staticScope = new PerInstantiationScope(null, ibex, null, null);
+ t.staticObject = new JS();
+ t.staticScope = new PerInstantiationScope(null, ibex, null, t.staticObject);
if (staticScript != null) JS.cloneWithNewParentScope(staticScript, t.staticScope).call(null, null, null, null, 0);
}
if (staticScript != null) JS.cloneWithNewParentScope(staticScript, t.staticScope).call(null, null, null, null, 0);
}
@@
-232,11
+234,10
@@
public class Template {
// process attributes into Vecs, dealing with any XML Namespaces in the process
ATTR: for (int i=0; i < c.getAttrLen(); i++) {
// process attributes into Vecs, dealing with any XML Namespaces in the process
ATTR: for (int i=0; i < c.getAttrLen(); i++) {
- //#switch(c.getAttrKey(i))
- case "id":
+ if (c.getAttrKey(i).equals("id")) {
t.id = c.getAttrVal(i).toString().intern();
continue ATTR;
t.id = c.getAttrVal(i).toString().intern();
continue ATTR;
- //#end
+ }
// treat value starting with '.' as resource reference
String uri = c.getAttrUri(i); if (!uri.equals("")) uri = '.' + uri;
// treat value starting with '.' as resource reference
String uri = c.getAttrUri(i); if (!uri.equals("")) uri = '.' + uri;
@@
-294,6
+295,7
@@
public class Template {
nodeStack.setSize(nodeStack.size() - 1);
t.children.addElement(oldt);
int oldt_lines = getLine() - oldt.startLine;
nodeStack.setSize(nodeStack.size() - 1);
t.children.addElement(oldt);
int oldt_lines = getLine() - oldt.startLine;
+ if (t.content == null) t.content = new StringBuffer();
for (int i=0; oldt_lines > i; i++) t.content.append('\n');
}
}
for (int i=0; oldt_lines > i; i++) t.content.append('\n');
}
}
@@
-326,13
+328,13
@@
public class Template {
private static class PerInstantiationScope extends JSScope {
Ibex ibex = null;
PerInstantiationScope parentBoxPis = null;
private static class PerInstantiationScope extends JSScope {
Ibex ibex = null;
PerInstantiationScope parentBoxPis = null;
- JSScope myStatic = null;
+ JS myStatic = null;
void putDollar(String key, Box target) throws JSExn {
if (parentBoxPis != null) parentBoxPis.putDollar(key, target);
declare("$" + key);
put("$" + key, target);
}
void putDollar(String key, Box target) throws JSExn {
if (parentBoxPis != null) parentBoxPis.putDollar(key, target);
declare("$" + key);
put("$" + key, target);
}
- public PerInstantiationScope(JSScope parentScope, Ibex ibex, PerInstantiationScope parentBoxPis, JSScope myStatic) {
+ public PerInstantiationScope(JSScope parentScope, Ibex ibex, PerInstantiationScope parentBoxPis, JS myStatic) {
super(parentScope);
this.parentBoxPis = parentBoxPis;
this.ibex = ibex;
super(parentScope);
this.parentBoxPis = parentBoxPis;
this.ibex = ibex;