Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

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

allo82d78fdab76b
diff --git a/source/de/anomic/tools/bbCode.java b/source/de/anomic/tools/bbCode.java
index d1821ff21..0eb9aaa36 100644
--- a/source/de/anomic/tools/bbCode.java
+++ b/source/de/anomic/tools/bbCode.java
@@ -41,25 +41,24 @@
/**Some code to avoid people being able to mess with the message system
*by using HTML.
*@author Marc Nause
+ extended for bbCode by Alexander Schier
*/
package de.anomic.tools;
-public class unHtml {
+public class bbCode {
String text;
- /**Creates an object so un() has something to work on*/
- public unHtml(String s)
+ /**init - no Code yet*/
+ 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
*@return String
*/
- public String un(){
- String input = this.text;
+ public String escapeHtml(String input){
String output = "";
int iter = 0;
@@ -73,4 +72,16 @@ public class unHtml {
return output;
}
-}
\ No newline at end of file
+
+ /**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;
+ }
+}