X-Git-Url: http://secure.phpeclipse.com diff --git a/archive/org.plog4u.wiki/src/org/plog4u/wiki/macro/LinkMacro.java b/archive/org.plog4u.wiki/src/org/plog4u/wiki/macro/LinkMacro.java deleted file mode 100644 index e3e08c0..0000000 --- a/archive/org.plog4u.wiki/src/org/plog4u/wiki/macro/LinkMacro.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * This file is part of "SnipSnap Radeox Rendering Engine". - * - * Copyright (c) 2002 Stephan J. Schmidt, Matthias L. Jugel - * All Rights Reserved. - * - * Please visit http://radeox.org/ for updates and contact. - * - * --LICENSE NOTICE-- - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * --LICENSE NOTICE-- - */ -package org.plog4u.wiki.macro; - -import java.io.IOException; -import java.io.Writer; - - -import org.plog4u.wiki.filter.ICachableMacro; -import org.radeox.api.engine.ImageRenderEngine; -import org.radeox.api.engine.RenderEngine; -import org.radeox.api.engine.context.RenderContext; -import org.radeox.macro.BaseLocaleMacro; -import org.radeox.macro.parameter.MacroParameter; -import org.radeox.util.Encoder; - -/* - * Macro for displaying external links with a name. The normal UrlFilter - * takes the url as a name. - * - * @author stephan - * @team sonicteam - */ - -public class LinkMacro extends BaseLocaleMacro implements ICachableMacro { - public String getLocaleKey() { - return "macro.link"; - } - - public void execute(Writer writer, MacroParameter params) - throws IllegalArgumentException, IOException { - - RenderContext context = params.getContext(); - RenderEngine engine = context.getRenderEngine(); - - String text = params.get("text", 0); - String url = params.get("url", 1); - String img = params.get("img", 2); - - // check for single url argument (text == url) - if(params.getLength() == 1) { - url = text; - text = Encoder.toEntity(text.charAt(0)) + Encoder.escape(text.substring(1)); - } - - if (url != null && text != null) { - writer.write(""); - if (!"none".equals(img) && engine instanceof ImageRenderEngine) { - writer.write(((ImageRenderEngine) engine).getExternalImageLink()); - } - writer.write(""); - writer.write(text); - writer.write(""); - } else { - throw new IllegalArgumentException("link needs a name and a url as argument"); - } - return; - } -}