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.Pattern;
06: import java.util.regex.Matcher;
07: import fitnesse.html.HtmlUtil;
08:
09: public class FixtureWidget extends TextWidget {
10: public static final String REGEXP = "^!fixture [^\r\n]*";
11: private static final Pattern pattern = Pattern
12: .compile("^!fixture (.*)");
13:
14: public FixtureWidget(ParentWidget parent, String text) {
15: super (parent);
16: Matcher match = pattern.matcher(text);
17: if (match.find())
18: this .text = match.group(1);
19: }
20:
21: public String render() throws Exception {
22: return HtmlUtil.metaText("fixture: " + getText());
23: }
24:
25: public String asWikiText() throws Exception {
26: return "!fixture " + this.text;
27: }
28: }
|