*) added escape characters [= and =] to yacyWiki

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@622 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
low012 19 years ago
parent c1d7527929
commit 2ee4f9f4e5

@ -71,6 +71,9 @@ public class wikiCode {
private String ListLevel="";
private String defListLevel="";
private plasmaSwitchboard sb;
private boolean escape = false; //needed for escape
private boolean escapeSpan = false; //needed for escape symbols [= and =] spanning over several lines
public wikiCode(plasmaSwitchboard switchboard){
sb=switchboard;
}
@ -110,6 +113,11 @@ public class wikiCode {
//p0 = 0; while ((p0 = result.indexOf("*", p0+1)) >= 0) result = result.substring(0, p0) + "•" + result.substring(p0 + 1);
p0 = 0; while ((p0 = result.indexOf("(C)", p0+1)) >= 0) result = result.substring(0, p0) + "©" + result.substring(p0 + 3);
//check if line contains any escape symbol of if we are in an esacpe sequence already
//if that's the case the program will continue further below [MN]
if((result.indexOf("[=")<0)&&(result.indexOf("=]")<0)&&(!escapeSpan)){
// format lines
if (result.startsWith(" ")) result = "<tt>" + result + "</tt>";
if (result.startsWith("----")) result = "<hr>";
@ -373,8 +381,36 @@ public class wikiCode {
result.substring(p1 + 1);
}
}
}
if ((result.endsWith("</li>"))||(defList)) return result; else return result + "<br>";
//escape code contributed by [MN]
//both [= and =] in the same line
else if(((p0 = result.indexOf("[="))>=0)&&((p1 = result.indexOf("=]"))>=0)){
String escapeText = result.substring(p0+2,p1);
result = transformLine(result.substring(0,p0)+"!escape!!Text!"+result.substring(p1+2), switchboard);
result = result.replaceAll("!escape!!Text!", escapeText);
}
//start [=
else if(((p0 = result.indexOf("[="))>=0)&&(!escapeSpan)){
escape = true; //prevent surplus line breaks
String escapeText = result.substring(p0+2);
result = transformLine(result.substring(0,p0)+"!escape!!Text!", switchboard);
result = result.replaceAll("!escape!!Text!", escapeText);
escape = false;
escapeSpan = true;
}
//end =]
else if(((p0 = result.indexOf("=]"))>=0)&&(escapeSpan)){
escapeSpan = false;
String escapeText = result.substring(0,p0);
result = transformLine("!escape!!Text!"+result.substring(p0+2), switchboard);
result = result.replaceAll("!escape!!Text!", escapeText);
}
//end contrib [MN]
if ((result.endsWith("</li>"))||(defList)||(escape)) return result; else return result + "<br>";
}
/*
what we need:
@ -403,6 +439,11 @@ public class wikiCode {
A picture: [[Image:Wiki.png]]
[[Image:Wiki.png|right|jigsaw globe]] (floating right-side with caption)
what we got in addition to that:
[= escape characters =]
*/
}

Loading…
Cancel
Save