You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-commits@incubator.apache.org by xa...@apache.org on 2007/06/05 11:02:08 UTC

svn commit: r544444 - in /incubator/ivy/core/trunk/doc/xooki: xooki.js xookiEdit.js

Author: xavier
Date: Tue Jun  5 04:02:04 2007
New Revision: 544444

URL: http://svn.apache.org/viewvc?view=rev&rev=544444
Log:
upgrade xooki version: better handling of eol

Modified:
    incubator/ivy/core/trunk/doc/xooki/xooki.js
    incubator/ivy/core/trunk/doc/xooki/xookiEdit.js

Modified: incubator/ivy/core/trunk/doc/xooki/xooki.js
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/doc/xooki/xooki.js?view=diff&rev=544444&r1=544443&r2=544444
==============================================================================
--- incubator/ivy/core/trunk/doc/xooki/xooki.js (original)
+++ incubator/ivy/core/trunk/doc/xooki/xooki.js Tue Jun  5 04:02:04 2007
@@ -648,7 +648,7 @@
             //      xooki.c.shortcuts.<any shortcut>.url = base url of the shortcut. 
             //      ex: xooki.c.shortcuts.svn.url = https://xooki.svn.sourceforge.net/svnroot/xooki/trunk/
             return input.replace(new RegExp("\\[\\[([^:]+):([^\\]]+)\\]\\]", "g"), function (str, prefix, code, offset, s) {
-            	if (typeof xooki.c.shortcuts[prefix] == "undefined") {
+            	if (typeof xooki.c.shortcuts == "undefined" || typeof xooki.c.shortcuts[prefix] == "undefined") {
             		return str;
             	}
                 var index = code.indexOf(' ');

Modified: incubator/ivy/core/trunk/doc/xooki/xookiEdit.js
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/doc/xooki/xookiEdit.js?view=diff&rev=544444&r1=544443&r2=544444
==============================================================================
--- incubator/ivy/core/trunk/doc/xooki/xookiEdit.js (original)
+++ incubator/ivy/core/trunk/doc/xooki/xookiEdit.js Tue Jun  5 04:02:04 2007
@@ -68,6 +68,12 @@
 	return(true);
 }
 
+// fix EOL characters in text to use native characters
+xooki.io.fixEOL = function(text) {
+	var nativeEOL = navigator.platform.indexOf('Win') != -1 ? '\r\n' : '\n';
+	return text.replace(/\r?\n/g, nativeEOL);
+}
+
 
 if (typeof xooki.string == "undefined") {
     xooki.string = {};
@@ -257,7 +263,7 @@
 					xooki.input.source() +
 					original.substr(posClosingArea);
 					
-		save = xooki.io.saveFile(localPath,revised);
+		save = xooki.io.saveFile(localPath,xooki.io.fixEOL(revised));
 	} catch (e) {
 		xooki.error(e);
 	} 
@@ -340,7 +346,7 @@
     	var save;
     	try {
     		// Save new file
-    		save = xooki.io.saveFile(localPath,revised);
+    		save = xooki.io.saveFile(localPath,xooki.io.fixEOL(revised));
     	} catch (e) {
     		xooki.error(e);
     	} 
@@ -360,7 +366,7 @@
 	var save;
 	var tocPath = xooki.io.getLocalPath(cu("toc"));
 	try {
-		save = xooki.io.saveFile(tocPath, revised);
+		save = xooki.io.saveFile(tocPath, xooki.io.fixEOL(revised));
 	} catch (e) {
 		xooki.error(e);
 	}