01: package org.radeox.macro;
02:
03: /*
04: * This file is part of "SnipSnap Radeox Rendering Engine".
05: *
06: * Copyright (c) 2002 Stephan J. Schmidt, Matthias L. Jugel
07: * All Rights Reserved.
08: *
09: * Please visit http://radeox.org/ for updates and contact.
10: *
11: * --LICENSE NOTICE--
12: * Licensed under the Apache License, Version 2.0 (the "License");
13: * you may not use this file except in compliance with the License.
14: * You may obtain a copy of the License at
15: *
16: * http://www.apache.org/licenses/LICENSE-2.0
17: *
18: * Unless required by applicable law or agreed to in writing, software
19: * distributed under the License is distributed on an "AS IS" BASIS,
20: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21: * See the License for the specific language governing permissions and
22: * limitations under the License.
23: * --LICENSE NOTICE--
24: */
25:
26: import java.io.IOException;
27: import java.io.Writer;
28:
29: import org.apache.commons.logging.Log;
30: import org.apache.commons.logging.LogFactory;
31: import org.radeox.Messages;
32: import org.radeox.api.macro.MacroParameter;
33:
34: /*
35: * Displays a mail to link. @author stephan @team sonicteam
36: *
37: * @version $Id: MailToMacro.java 29159 2007-04-19 01:46:15Z ajpoland@iupui.edu $
38: */
39:
40: public class MailToMacro extends LocalePreserved {
41: private static Log log = LogFactory.getLog(MailToMacro.class);
42:
43: private String[] paramDescription = { Messages
44: .getString("MailToMacro.0") }; //$NON-NLS-1$
45:
46: public String getLocaleKey() {
47: return "macro.mailto"; //$NON-NLS-1$
48: }
49:
50: public String[] getParamDescription() {
51: return paramDescription;
52: }
53:
54: public void execute(Writer writer, MacroParameter params)
55: throws IllegalArgumentException, IOException {
56:
57: if (params.getLength() == 1) {
58: String mail = params.get("0"); //$NON-NLS-1$
59: writer
60: .write("<a href=\"mailto:" + mail + "\">" + mail + "</a>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
61: }
62: return;
63: }
64: }
|