new Implementation and basic bbCode(Ok, opnly one Command ...)

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@343 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
allo 20 years ago
parent a60f5efcd6
commit 82d78fdab7

@ -41,25 +41,24 @@
/**Some code to avoid people being able to mess with the message system /**Some code to avoid people being able to mess with the message system
*by using HTML. *by using HTML.
*@author Marc Nause *@author Marc Nause
extended for bbCode by Alexander Schier
*/ */
package de.anomic.tools; package de.anomic.tools;
public class unHtml { public class bbCode {
String text; String text;
/**Creates an object so un() has something to work on*/ /**init - no Code yet*/
public unHtml(String s) public bbCode()
{ {
this.text = s;
} }
/**Replaces all < and > with &lt; and &gt in a string. /**Replaces all < and > with &lt; and &gt; in a string.
*@author Marc Nause *@author Marc Nause
*@return String *@return String
*/ */
public String un(){ public String escapeHtml(String input){
String input = this.text;
String output = ""; String output = "";
int iter = 0; int iter = 0;
@ -73,4 +72,16 @@ public class unHtml {
return output; return output;
} }
}
/**Parses parts of bbCode (will be extended).
*@author Alexander Schier
*@return String
*/
public String bb(String input){
String output = escapeHtml(input);
output = output.replaceAll("\\[b\\]", "<b>");
output = output.replaceAll("\\[/b\\]", "</b>");
return output;
}
}

Loading…
Cancel
Save