01: // Copyright (C) 2003,2004,2005 by Object Mentor, Inc. All rights reserved.
02: // Released under the terms of the GNU General Public License version 2 or later.
03: package fitnesse.wikitext.widgets;
04:
05: import java.util.regex.Matcher;
06: import java.util.regex.Pattern;
07:
08: public class ItalicWidget extends ParentWidget {
09: public static final String REGEXP = "''.+?''";
10:
11: private static final Pattern pattern = Pattern.compile("''(.+?)''",
12: Pattern.MULTILINE + Pattern.DOTALL);
13:
14: public ItalicWidget(ParentWidget parent, String text)
15: throws Exception {
16: super (parent);
17: Matcher match = pattern.matcher(text);
18: if (match.find())
19: addChildWidgets(match.group(1));
20: else
21: System.err.println("ItalicWidget: match was not found");
22: }
23:
24: public String render() throws Exception {
25: StringBuffer html = new StringBuffer("<i>");
26: html.append(childHtml()).append("</i>");
27:
28: return html.toString();
29: }
30:
31: }
|