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 BoldWidget extends ParentWidget {
09: public static final String REGEXP = "'''.+?'''";
10: private static final Pattern pattern = Pattern.compile(
11: "'''(.+?)'''", Pattern.MULTILINE + Pattern.DOTALL);
12:
13: public BoldWidget(ParentWidget parent, String text)
14: throws Exception {
15: super (parent);
16: Matcher match = pattern.matcher(text);
17: match.find();
18: addChildWidgets(match.group(1));
19: }
20:
21: public String render() throws Exception {
22: StringBuffer html = new StringBuffer("<b>");
23: html.append(childHtml()).append("</b>");
24: return html.toString();
25: }
26: }
|