You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by hi...@apache.org on 2010/12/14 00:06:25 UTC
svn commit: r1045414 [1/3] - in /ant/ivy/site/xooki: ./ images/ tiddly/
trimpath/
Author: hibou
Date: Mon Dec 13 23:06:24 2010
New Revision: 1045414
URL: http://svn.apache.org/viewvc?rev=1045414&view=rev
Log:
svn_apply_autoprops, mainly for line endings
Modified:
ant/ivy/site/xooki/antlib.xml (props changed)
ant/ivy/site/xooki/blankPageTpl.html (props changed)
ant/ivy/site/xooki/images/addchild.gif (props changed)
ant/ivy/site/xooki/images/debug.gif (props changed)
ant/ivy/site/xooki/images/delete.gif (props changed)
ant/ivy/site/xooki/images/down.gif (props changed)
ant/ivy/site/xooki/images/edit.gif (props changed)
ant/ivy/site/xooki/images/save.gif (props changed)
ant/ivy/site/xooki/images/up.gif (props changed)
ant/ivy/site/xooki/messages.json
ant/ivy/site/xooki/tiddly/util.js (contents, props changed)
ant/ivy/site/xooki/trimpath/template.js (contents, props changed)
ant/ivy/site/xooki/xooki.js (contents, props changed)
ant/ivy/site/xooki/xookiEdit.js (contents, props changed)
Propchange: ant/ivy/site/xooki/antlib.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange: ant/ivy/site/xooki/antlib.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Propchange: ant/ivy/site/xooki/blankPageTpl.html
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange: ant/ivy/site/xooki/blankPageTpl.html
------------------------------------------------------------------------------
svn:mime-type = text/html
Propchange: ant/ivy/site/xooki/images/addchild.gif
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Mon Dec 13 23:06:24 2010
@@ -1 +1 @@
-application/octet-stream
+image/gif
Propchange: ant/ivy/site/xooki/images/debug.gif
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Mon Dec 13 23:06:24 2010
@@ -1 +1 @@
-application/octet-stream
+image/gif
Propchange: ant/ivy/site/xooki/images/delete.gif
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Mon Dec 13 23:06:24 2010
@@ -1 +1 @@
-application/octet-stream
+image/gif
Propchange: ant/ivy/site/xooki/images/down.gif
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Mon Dec 13 23:06:24 2010
@@ -1 +1 @@
-application/octet-stream
+image/gif
Propchange: ant/ivy/site/xooki/images/edit.gif
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Mon Dec 13 23:06:24 2010
@@ -1 +1 @@
-application/octet-stream
+image/gif
Propchange: ant/ivy/site/xooki/images/save.gif
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Mon Dec 13 23:06:24 2010
@@ -1 +1 @@
-application/octet-stream
+image/gif
Propchange: ant/ivy/site/xooki/images/up.gif
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Mon Dec 13 23:06:24 2010
@@ -1 +1 @@
-application/octet-stream
+image/gif
Modified: ant/ivy/site/xooki/messages.json
URL: http://svn.apache.org/viewvc/ant/ivy/site/xooki/messages.json?rev=1045414&r1=1045413&r2=1045414&view=diff
==============================================================================
--- ant/ivy/site/xooki/messages.json (original)
+++ ant/ivy/site/xooki/messages.json Mon Dec 13 23:06:24 2010
@@ -1,3 +1,21 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+*/
{
"Impossible to save changes to ${0}": "Impossible to save changes to ${0}.\n This could be because your browser doesn't support saving (instead, use FireFox if you can), or because the pathname to your Xooki file contains illegal characters"
}
Modified: ant/ivy/site/xooki/tiddly/util.js
URL: http://svn.apache.org/viewvc/ant/ivy/site/xooki/tiddly/util.js?rev=1045414&r1=1045413&r2=1045414&view=diff
==============================================================================
--- ant/ivy/site/xooki/tiddly/util.js (original)
+++ ant/ivy/site/xooki/tiddly/util.js Mon Dec 13 23:06:24 2010
@@ -1,174 +1,174 @@
-// utility functions borrowed from tiddly wiki: http://www.tiddlywiki.com/
-// Tiddly Wiki License:
-/*
-TiddlyWiki 2.1.3 by Jeremy Ruston, (jeremy [at] osmosoft [dot] com)
-
-Copyright (c) Osmosoft Limited 2004-2006
-
-Redistribution and use in source and binary forms, with or without modification,
-are permitted provided that the following conditions are met:
-
-Redistributions of source code must retain the above copyright notice, this
-list of conditions and the following disclaimer.
-
-Redistributions in binary form must reproduce the above copyright notice, this
-list of conditions and the following disclaimer in the documentation and/or other
-materials provided with the distribution.
-
-Neither the name of the Osmosoft Limited nor the names of its contributors may be
-used to endorse or promote products derived from this software without specific
-prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
-EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
-SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
-TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.
-*/
-
-if (typeof xooki.io == "undefined") {
- xooki.io = {};
-}
-
-xooki.io.saveFile = function (fileUrl, content) {
- var r = null;
- if((r == null) || (r == false))
- r = mozillaSaveFile(fileUrl, content);
- if((r == null) || (r == false))
- r = ieSaveFile(fileUrl, content);
- return(r);
-}
-
-xooki.io.loadFile = function (fileUrl) {
- var r = null;
- if((r == null) || (r == false))
- r = mozillaLoadFile(fileUrl);
- if((r == null) || (r == false))
- r = ieLoadFile(fileUrl);
- return(r);
-}
-
-xooki.io.getLocalPath = function (originalPath) {
- // Remove any location or query part of the URL
- var argPos = originalPath.indexOf("?");
- if(argPos != -1)
- originalPath = originalPath.substr(0,argPos);
- var hashPos = originalPath.indexOf("#");
- if(hashPos != -1)
- originalPath = originalPath.substr(0,hashPos);
- // Convert file://localhost/ to file:///
- if(originalPath.indexOf("file://localhost/") == 0)
- originalPath = "file://" + originalPath.substr(16);
- // Convert to a native file format assuming
- // "file:///x:/path/path/path..." - pc local file --> "x:\path\path\path..."
- // "file://///server/share/path/path/path..." - FireFox pc network file --> "\\server\share\path\path\path..."
- // "file:///path/path/path..." - mac/unix local file --> "/path/path/path..."
- // "file://server/share/path/path/path..." - pc network file --> "\\server\share\path\path\path..."
- var localPath;
- if(originalPath.charAt(9) == ":") // pc local file
- localPath = unescape(originalPath.substr(8)).replace(new RegExp("/","g"),"\\");
- else if(originalPath.indexOf("file://///") == 0) // FireFox pc network file
- localPath = "\\\\" + unescape(originalPath.substr(10)).replace(new RegExp("/","g"),"\\");
- else if(originalPath.indexOf("file:///") == 0) // mac/unix local file
- localPath = unescape(originalPath.substr(7));
- else if(originalPath.indexOf("file:/") == 0) // mac/unix local file
- localPath = unescape(originalPath.substr(5));
- else // pc network file
- localPath = "\\\\" + unescape(originalPath.substr(7)).replace(new RegExp("/","g"),"\\");
- return localPath;
-}
-
-
-// Returns null if it can't do it, false if there's an error, true if it saved OK
-function ieSaveFile(filePath, content)
-{
- try
- {
- var fso = new ActiveXObject("Scripting.FileSystemObject");
- }
- catch(e)
- {
- //alert("Exception while attempting to save\n\n" + e.toString());
- return(null);
- }
- var file = fso.OpenTextFile(filePath,2,-1,0);
- file.Write(content);
- file.Close();
- return(true);
-}
-
-// Returns null if it can't do it, false if there's an error, or a string of the content if successful
-function ieLoadFile(filePath)
-{
- try
- {
- var fso = new ActiveXObject("Scripting.FileSystemObject");
- var file = fso.OpenTextFile(filePath,1);
- var content = file.ReadAll();
- file.Close();
- }
- catch(e)
- {
- //alert("Exception while attempting to load\n\n" + e.toString());
- return(null);
- }
- return(content);
-}
-
-// Returns null if it can't do it, false if there's an error, true if it saved OK
-function mozillaSaveFile(filePath, content)
-{
- if(window.Components)
- try
- {
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
- file.initWithPath(filePath);
- if (!file.exists())
- file.create(0, 0664);
- var out = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);
- out.init(file, 0x20 | 0x02, 00004,null);
- out.write(content, content.length);
- out.flush();
- out.close();
- return(true);
- }
- catch(e)
- {
- //alert("Exception while attempting to save\n\n" + e);
- return(false);
- }
- return(null);
-}
-
-// Returns null if it can't do it, false if there's an error, or a string of the content if successful
-function mozillaLoadFile(filePath)
-{
- if(window.Components)
- try
- {
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
- file.initWithPath(filePath);
- if (!file.exists())
- return(null);
- var inputStream = Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream);
- inputStream.init(file, 0x01, 00004, null);
- var sInputStream = Components.classes["@mozilla.org/scriptableinputstream;1"].createInstance(Components.interfaces.nsIScriptableInputStream);
- sInputStream.init(inputStream);
- return(sInputStream.read(sInputStream.available()));
- }
- catch(e)
- {
- //alert("Exception while attempting to load\n\n" + e);
- return(false);
- }
- return(null);
-}
-
-// end tiddly wiki borrowed code
+// utility functions borrowed from tiddly wiki: http://www.tiddlywiki.com/
+// Tiddly Wiki License:
+/*
+TiddlyWiki 2.1.3 by Jeremy Ruston, (jeremy [at] osmosoft [dot] com)
+
+Copyright (c) Osmosoft Limited 2004-2006
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this
+list of conditions and the following disclaimer.
+
+Redistributions in binary form must reproduce the above copyright notice, this
+list of conditions and the following disclaimer in the documentation and/or other
+materials provided with the distribution.
+
+Neither the name of the Osmosoft Limited nor the names of its contributors may be
+used to endorse or promote products derived from this software without specific
+prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGE.
+*/
+
+if (typeof xooki.io == "undefined") {
+ xooki.io = {};
+}
+
+xooki.io.saveFile = function (fileUrl, content) {
+ var r = null;
+ if((r == null) || (r == false))
+ r = mozillaSaveFile(fileUrl, content);
+ if((r == null) || (r == false))
+ r = ieSaveFile(fileUrl, content);
+ return(r);
+}
+
+xooki.io.loadFile = function (fileUrl) {
+ var r = null;
+ if((r == null) || (r == false))
+ r = mozillaLoadFile(fileUrl);
+ if((r == null) || (r == false))
+ r = ieLoadFile(fileUrl);
+ return(r);
+}
+
+xooki.io.getLocalPath = function (originalPath) {
+ // Remove any location or query part of the URL
+ var argPos = originalPath.indexOf("?");
+ if(argPos != -1)
+ originalPath = originalPath.substr(0,argPos);
+ var hashPos = originalPath.indexOf("#");
+ if(hashPos != -1)
+ originalPath = originalPath.substr(0,hashPos);
+ // Convert file://localhost/ to file:///
+ if(originalPath.indexOf("file://localhost/") == 0)
+ originalPath = "file://" + originalPath.substr(16);
+ // Convert to a native file format assuming
+ // "file:///x:/path/path/path..." - pc local file --> "x:\path\path\path..."
+ // "file://///server/share/path/path/path..." - FireFox pc network file --> "\\server\share\path\path\path..."
+ // "file:///path/path/path..." - mac/unix local file --> "/path/path/path..."
+ // "file://server/share/path/path/path..." - pc network file --> "\\server\share\path\path\path..."
+ var localPath;
+ if(originalPath.charAt(9) == ":") // pc local file
+ localPath = unescape(originalPath.substr(8)).replace(new RegExp("/","g"),"\\");
+ else if(originalPath.indexOf("file://///") == 0) // FireFox pc network file
+ localPath = "\\\\" + unescape(originalPath.substr(10)).replace(new RegExp("/","g"),"\\");
+ else if(originalPath.indexOf("file:///") == 0) // mac/unix local file
+ localPath = unescape(originalPath.substr(7));
+ else if(originalPath.indexOf("file:/") == 0) // mac/unix local file
+ localPath = unescape(originalPath.substr(5));
+ else // pc network file
+ localPath = "\\\\" + unescape(originalPath.substr(7)).replace(new RegExp("/","g"),"\\");
+ return localPath;
+}
+
+
+// Returns null if it can't do it, false if there's an error, true if it saved OK
+function ieSaveFile(filePath, content)
+{
+ try
+ {
+ var fso = new ActiveXObject("Scripting.FileSystemObject");
+ }
+ catch(e)
+ {
+ //alert("Exception while attempting to save\n\n" + e.toString());
+ return(null);
+ }
+ var file = fso.OpenTextFile(filePath,2,-1,0);
+ file.Write(content);
+ file.Close();
+ return(true);
+}
+
+// Returns null if it can't do it, false if there's an error, or a string of the content if successful
+function ieLoadFile(filePath)
+{
+ try
+ {
+ var fso = new ActiveXObject("Scripting.FileSystemObject");
+ var file = fso.OpenTextFile(filePath,1);
+ var content = file.ReadAll();
+ file.Close();
+ }
+ catch(e)
+ {
+ //alert("Exception while attempting to load\n\n" + e.toString());
+ return(null);
+ }
+ return(content);
+}
+
+// Returns null if it can't do it, false if there's an error, true if it saved OK
+function mozillaSaveFile(filePath, content)
+{
+ if(window.Components)
+ try
+ {
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
+ file.initWithPath(filePath);
+ if (!file.exists())
+ file.create(0, 0664);
+ var out = Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);
+ out.init(file, 0x20 | 0x02, 00004,null);
+ out.write(content, content.length);
+ out.flush();
+ out.close();
+ return(true);
+ }
+ catch(e)
+ {
+ //alert("Exception while attempting to save\n\n" + e);
+ return(false);
+ }
+ return(null);
+}
+
+// Returns null if it can't do it, false if there's an error, or a string of the content if successful
+function mozillaLoadFile(filePath)
+{
+ if(window.Components)
+ try
+ {
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
+ file.initWithPath(filePath);
+ if (!file.exists())
+ return(null);
+ var inputStream = Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream);
+ inputStream.init(file, 0x01, 00004, null);
+ var sInputStream = Components.classes["@mozilla.org/scriptableinputstream;1"].createInstance(Components.interfaces.nsIScriptableInputStream);
+ sInputStream.init(inputStream);
+ return(sInputStream.read(sInputStream.available()));
+ }
+ catch(e)
+ {
+ //alert("Exception while attempting to load\n\n" + e);
+ return(false);
+ }
+ return(null);
+}
+
+// end tiddly wiki borrowed code
Propchange: ant/ivy/site/xooki/tiddly/util.js
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ant/ivy/site/xooki/tiddly/util.js
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange: ant/ivy/site/xooki/tiddly/util.js
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: ant/ivy/site/xooki/trimpath/template.js
URL: http://svn.apache.org/viewvc/ant/ivy/site/xooki/trimpath/template.js?rev=1045414&r1=1045413&r2=1045414&view=diff
==============================================================================
--- ant/ivy/site/xooki/trimpath/template.js (original)
+++ ant/ivy/site/xooki/trimpath/template.js Mon Dec 13 23:06:24 2010
@@ -30,17 +30,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-var TrimPath;
-
-// TODO: Debugging mode vs stop-on-error mode - runtime flag.
+var TrimPath;
+
+// TODO: Debugging mode vs stop-on-error mode - runtime flag.
// TODO: Handle || (or) characters and backslashes.
// TODO: Add more modifiers.
-
-(function() { // Using a closure to keep global namespace clean.
- if (TrimPath == null)
- TrimPath = new Object();
- if (TrimPath.evalEx == null)
- TrimPath.evalEx = function(src) { return eval(src); };
+
+(function() { // Using a closure to keep global namespace clean.
+ if (TrimPath == null)
+ TrimPath = new Object();
+ if (TrimPath.evalEx == null)
+ TrimPath.evalEx = function(src) { return eval(src); };
var UNDEFINED;
if (Array.prototype.pop == null) // IE 5.x fix from Igor Poteryaev.
@@ -54,28 +54,28 @@ var TrimPath;
return this.length;
};
- TrimPath.parseTemplate = function(tmplContent, optTmplName, optEtc) {
- if (optEtc == null)
- optEtc = TrimPath.parseTemplate_etc;
+ TrimPath.parseTemplate = function(tmplContent, optTmplName, optEtc) {
+ if (optEtc == null)
+ optEtc = TrimPath.parseTemplate_etc;
var funcSrc = parse(tmplContent, optTmplName, optEtc);
var func = TrimPath.evalEx(funcSrc, optTmplName, 1);
if (func != null)
return new optEtc.Template(optTmplName, tmplContent, funcSrc, func, optEtc);
return null;
- }
-
- try {
- String.prototype.process = function(context, optFlags) {
+ }
+
+ try {
+ String.prototype.process = function(context, optFlags) {
var template = TrimPath.parseTemplate(this, null);
if (template != null)
return template.process(context, optFlags);
- return this;
- }
- } catch (e) { // Swallow exception, such as when String.prototype is sealed.
- }
-
- TrimPath.parseTemplate_etc = {}; // Exposed for extensibility.
- TrimPath.parseTemplate_etc.statementTag = "forelse|for|if|elseif|else|var|macro";
+ return this;
+ }
+ } catch (e) { // Swallow exception, such as when String.prototype is sealed.
+ }
+
+ TrimPath.parseTemplate_etc = {}; // Exposed for extensibility.
+ TrimPath.parseTemplate_etc.statementTag = "forelse|for|if|elseif|else|var|macro";
TrimPath.parseTemplate_etc.statementDef = { // Lookup table for statement tags.
"if" : { delta: 1, prefix: "if (", suffix: ") {", paramMin: 1 },
"else" : { delta: 0, prefix: "} else {" },
@@ -111,55 +111,55 @@ var TrimPath;
"{ var _OUT_arr = []; var _OUT = { write: function(m) { if (m) _OUT_arr.push(m); } }; " ].join('');
} },
"/macro" : { delta: -1, prefix: " return _OUT_arr.join(''); };" }
- }
- TrimPath.parseTemplate_etc.modifierDef = {
- "eat" : function(v) { return ""; },
- "escape" : function(s) { return String(s).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"); },
- "capitalize" : function(s) { return String(s).toUpperCase(); },
- "default" : function(s, d) { return s != null ? s : d; }
+ }
+ TrimPath.parseTemplate_etc.modifierDef = {
+ "eat" : function(v) { return ""; },
+ "escape" : function(s) { return String(s).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"); },
+ "capitalize" : function(s) { return String(s).toUpperCase(); },
+ "default" : function(s, d) { return s != null ? s : d; }
}
TrimPath.parseTemplate_etc.modifierDef.h = TrimPath.parseTemplate_etc.modifierDef.escape;
-
+
TrimPath.parseTemplate_etc.Template = function(tmplName, tmplContent, funcSrc, func, etc) {
- this.process = function(context, flags) {
- if (context == null)
- context = {};
- if (context._MODIFIERS == null)
+ this.process = function(context, flags) {
+ if (context == null)
+ context = {};
+ if (context._MODIFIERS == null)
context._MODIFIERS = {};
if (context.defined == null)
- context.defined = function(str) { return (context[str] != undefined); };
- for (var k in etc.modifierDef) {
- if (context._MODIFIERS[k] == null)
- context._MODIFIERS[k] = etc.modifierDef[k];
- }
- if (flags == null)
- flags = {};
+ context.defined = function(str) { return (context[str] != undefined); };
+ for (var k in etc.modifierDef) {
+ if (context._MODIFIERS[k] == null)
+ context._MODIFIERS[k] = etc.modifierDef[k];
+ }
+ if (flags == null)
+ flags = {};
var resultArr = [];
- var resultOut = { write: function(m) { resultArr.push(m); } };
+ var resultOut = { write: function(m) { resultArr.push(m); } };
try {
- func(resultOut, context, flags);
- } catch (e) {
- if (flags.throwExceptions == true)
- throw e;
+ func(resultOut, context, flags);
+ } catch (e) {
+ if (flags.throwExceptions == true)
+ throw e;
var result = new String(resultArr.join("") + "[ERROR: " + e.toString() + (e.message ? '; ' + e.message : '') + "]");
result["exception"] = e;
- return result;
+ return result;
}
return resultArr.join("");
- }
- this.name = tmplName;
- this.source = tmplContent;
- this.sourceFunc = funcSrc;
+ }
+ this.name = tmplName;
+ this.source = tmplContent;
+ this.sourceFunc = funcSrc;
this.toString = function() { return "TrimPath.Template [" + tmplName + "]"; }
}
- TrimPath.parseTemplate_etc.ParseError = function(name, line, message) {
+ TrimPath.parseTemplate_etc.ParseError = function(name, line, message) {
this.name = name;
this.line = line;
this.message = message;
}
TrimPath.parseTemplate_etc.ParseError.prototype.toString = function() {
return ("TrimPath template ParseError in " + this.name + ": line " + this.line + ", " + this.message);
- }
+ }
var parse = function(body, tmplName, etc) {
body = cleanWhiteSpace(body);
@@ -263,12 +263,12 @@ var TrimPath;
funcText.push(stmt.suffix);
}
}
-
+
var emitSectionText = function(text, funcText) {
if (text.length <= 0)
return;
var nlPrefix = 0; // Index to first non-newline in prefix.
- var nlSuffix = text.length - 1; // Index to first non-space/tab in suffix.
+ var nlSuffix = text.length - 1; // Index to first non-space/tab in suffix.
while (nlPrefix < text.length && (text.charAt(nlPrefix) == '\n'))
nlPrefix++;
while (nlSuffix >= 0 && (text.charAt(nlSuffix) == ' ' || text.charAt(nlSuffix) == '\t'))
@@ -276,7 +276,7 @@ var TrimPath;
if (nlSuffix < nlPrefix)
nlSuffix = nlPrefix;
if (nlPrefix > 0) {
- funcText.push('if (_FLAGS.keepWhitespace == true) _OUT.write("');
+ funcText.push('if (_FLAGS.keepWhitespace == true) _OUT.write("');
var s = text.substring(0, nlPrefix).replace('\n', '\\n'); // A macro IE fix from BJessen.
if (s.charAt(s.length - 1) == '\n')
s = s.substring(0, s.length - 1);
@@ -288,7 +288,7 @@ var TrimPath;
emitSectionTextLine(lines[i], funcText);
if (i < lines.length - 1)
funcText.push('_OUT.write("\\n");\n');
- }
+ }
if (nlSuffix + 1 < text.length) {
funcText.push('if (_FLAGS.keepWhitespace == true) _OUT.write("');
var s = text.substring(nlSuffix + 1).replace('\n', '\\n');
@@ -345,7 +345,7 @@ var TrimPath;
var emitExpression = function(exprArr, index, funcText) {
// Ex: foo|a:x|b:y1,y2|c:z1,z2 is emitted as c(b(a(foo,x),y1,y2),z1,z2)
var expr = exprArr[index]; // Ex: exprArr == [firstName,capitalize,default:"John Doe"]
- if (index <= 0) { // Ex: expr == 'default:"John Doe"'
+ if (index <= 0) { // Ex: expr == 'default:"John Doe"'
funcText.push(expr);
return;
}
@@ -359,7 +359,7 @@ var TrimPath;
funcText.push(parts[1]);
}
funcText.push(')');
- }
+ }
var cleanWhiteSpace = function(result) {
result = result.replace(/\t/g, " ");
Propchange: ant/ivy/site/xooki/trimpath/template.js
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: ant/ivy/site/xooki/trimpath/template.js
------------------------------------------------------------------------------
svn:keywords = Date Revision Author HeadURL Id
Propchange: ant/ivy/site/xooki/trimpath/template.js
------------------------------------------------------------------------------
svn:mime-type = text/plain