public String apply(Context ctxt) throws ServiceException { String text = ctxt.token.getValue(); String link = text; String title = text; int pos = text.indexOf('|'); if (pos != -1) { link = text.substring(0, pos); title = text.substring(pos+1);
public String apply(Context ctxt) throws ServiceException, IOException { String link, title; if (ctxt.token.getType() == Token.TokenType.WIKILINK) { String text = ctxt.token.getValue(); if (text.startsWith("http: link = text; title = text; } else if (text.startsWith("<wiklet")) { WikiTemplate template = new WikiTemplate(text); link = template.toString(ctxt); title = link; } else { link = text; title = text; int pos = text.indexOf('|'); if (pos != -1) { link = text.substring(0, pos); title = text.substring(pos+1); } else { pos = text.indexOf("]["); if (pos != -1) { title = text.substring(0, pos); link = text.substring(pos+2); } } }
		public String apply(Context ctxt) throws ServiceException {			String text = ctxt.token.getValue();			String link = text;			String title = text;			int pos = text.indexOf('|');			if (pos != -1) {				link = text.substring(0, pos);				title = text.substring(pos+1);			} else {				pos = text.indexOf("][");				if (pos != -1) {					title = text.substring(0, pos);					link = text.substring(pos+2);				}			}			WikiUrl wurl = new WikiUrl(link, ctxt.item.getFolderId());			StringBuffer buf = new StringBuffer();			buf.append("<a href='");			if (wurl.isRemote())				buf.append(URL_PREFIX).append(wurl.getToken(1)).append('/').append(wurl.getToken(2));			else if (wurl.isAbsolute())				buf.append(URL_PREFIX).append(ctxt.item.getMailbox().getAccount().getUid()).append(wurl.getToken(1));			else				buf.append(link);			buf.append("'>").append(title).append("</a>");			return buf.toString();		}