abstract wikiCode in putWiki

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3293 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
allo 18 years ago
parent f25c0e98d1
commit 98cb777e18

@ -151,12 +151,11 @@ public class Wiki {
//contributed by [MN]
else if (post.containsKey("preview")) {
// preview the page
wikiCode wikiTransformer=new wikiCode(switchboard);
prop.put("mode", 2);//preview
prop.put("mode_pagename", pagename);
prop.put("mode_author", author);
prop.put("mode_date", dateString(new Date()));
prop.putASIS("mode_page", wikiTransformer.transform(post.get("content", "")));
prop.putWiki("mode_page", post.get("content", ""));
prop.put("mode_page-code", post.get("content", "").replaceAll("<","&lt;").replaceAll(">","&gt;"));
}
//end contrib of [MN]
@ -187,13 +186,12 @@ public class Wiki {
}
else {
wikiCode wikiTransformer=new wikiCode(switchboard);
// show page
prop.put("mode", 0); //viewing
prop.put("mode_pagename", pagename);
prop.put("mode_author", page.author());
prop.put("mode_date", dateString(page.date()));
prop.putASIS("mode_page", wikiTransformer.transform(page.page()));
prop.putWiki("mode_page", page.page());
prop.put("controls", 0);
prop.put("controls_pagename", pagename);

@ -67,6 +67,7 @@ import java.util.Hashtable;
import java.util.Map;
import de.anomic.data.wikiCode;
import de.anomic.plasma.plasmaSwitchboard;
public class serverObjects extends Hashtable implements Cloneable {
@ -120,6 +121,14 @@ public class serverObjects extends Hashtable implements Cloneable {
public String putASIS(Object key, String value) {
return (String) this.put(key, (Object) value);
}
public String putWiki(Object key, String wikiCode){
//XXX: This is ineffizient, if a lot of wikiCode is used on the same page.
//TODO: Cache the wikiCode Object?
return this.putASIS(key, (new wikiCode(plasmaSwitchboard.getSwitchboard())).transform(wikiCode));
}
public String putWiki(Object key, byte[] wikiCode){
return this.putASIS(key, (new wikiCode(plasmaSwitchboard.getSwitchboard())).transform(wikiCode));
}
// long variant
public long put(String key, long value) {

Loading…
Cancel
Save