From 8e7b214e419d145e4d3b19eafe588f5f98a641a3 Mon Sep 17 00:00:00 2001 From: low012 Date: Mon, 24 Oct 2005 22:37:10 +0000 Subject: [PATCH] *) 5 inverted commas are needed instead of only 4 to strongly emphasise a text (closer to Wikipedia's syntax now) *) Tried to fix nested
 and [= issues, but did not succeed due to sleepyness. Will continue
 work when I'm awake and have some time.

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@981 6c8d7289-2bf4-0310-a012-ef5d649a1542
---
 source/de/anomic/data/wikiCode.java | 31 ++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/source/de/anomic/data/wikiCode.java b/source/de/anomic/data/wikiCode.java
index 1c7505c6d..26d026108 100644
--- a/source/de/anomic/data/wikiCode.java
+++ b/source/de/anomic/data/wikiCode.java
@@ -170,11 +170,11 @@ public class wikiCode {
                                       result.substring(p1 + 2);
             }
 
-            if ((p0 = result.indexOf("''''")) >= 0) {
-                p1 = result.indexOf("''''", p0 + 4);
+            if ((p0 = result.indexOf("'''''")) >= 0) {
+                p1 = result.indexOf("'''''", p0 + 5);
                 if (p1 >= 0) result = result.substring(0, p0) + "" +
-                                      result.substring(p0 + 4, p1) + "" +
-                                      result.substring(p1 + 4);
+                                      result.substring(p0 + 5, p1) + "" +
+                                      result.substring(p1 + 5);
             }
             if ((p0 = result.indexOf("'''")) >= 0) {
                 p1 = result.indexOf("'''", p0 + 3);
@@ -332,7 +332,7 @@ public class wikiCode {
 		    kl = result.substring(p0 + 2, p1);
 		
 		    // this is the part of the code that's responsible for images
-		    // contibuted by [MN]
+		    // contributed by [MN]
 		    if(kl.startsWith("Image:")){
 			    alt = "";
 			    align = "";
@@ -400,7 +400,8 @@ public class wikiCode {
 	
 	//escape code ([=...=]) contributed by [MN]
 	//both [= and =] in the same line
-	else if(((p0 = result.indexOf("[="))>=0)&&((p1 = result.indexOf("=]"))>=0)&&(!(preformatted))){
+	else if(((p0 = result.indexOf("[="))>=0)&&((p1 = result.indexOf("=]"))>0)&&(!(preformatted))){
+	    //if(p0 < p1){
 	    String escapeText = result.substring(p0+2,p1);
 	    
 	    //BUGS TO BE FIXED: [=[=text=]=]  does not work properly:
@@ -409,9 +410,13 @@ public class wikiCode {
 	    //
 	    //handlicg cases where the text inside [= and =] also contains
 	    //[= and =]. Example: [=[=...=]=]
+	    //if(escapeText)
 	    
-	    result = transformLine(result.substring(0,p0)+"!escape!!Text!"+result.substring(p1+2), switchboard);
-	    result = result.replaceAll("!escape!!Text!", escapeText);
+	    //else{
+	        result = transformLine(result.substring(0,p0)+"!escape!!Text!"+result.substring(p1+2), switchboard);
+	        result = result.replaceAll("!escape!!Text!", escapeText);
+	    //}
+	    //}
 	}
 	
 	//start [=
@@ -450,10 +455,12 @@ public class wikiCode {
 	//preformatted code (
...
) contributed by [MN] //implementation very similar to escape code (see above) //both
 and 
in the same line - else if(((p0 = result.indexOf("<pre>"))>=0)&&((p1 = result.indexOf("</pre>"))>=0)&&(!(escaped))){ - String preformattedText = "
"+result.substring(p0+11,p1)+"
"; - result = transformLine(result.substring(0,p0)+"!preformatted!!Text!"+result.substring(p1+12), switchboard); - result = result.replaceAll("!preformatted!!Text!", preformattedText); + else if(((p0 = result.indexOf("<pre>"))>=0)&&((p1 = result.indexOf("</pre>"))>0)&&(!(escaped))){ + //if(p0 < p1){ + String preformattedText = "
"+result.substring(p0+11,p1)+"
"; + result = transformLine(result.substring(0,p0)+"!preformatted!!Text!"+result.substring(p1+12), switchboard); + result = result.replaceAll("!preformatted!!Text!", preformattedText); + //} } //start