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:
12: private static final Pattern pattern = Pattern
13: .compile("^!fixture (.*)");
14:
15: public FixtureWidget(ParentWidget parent, String text) {
16: super (parent);
17: Matcher match = pattern.matcher(text);
18: if (match.find())
19: this .text = match.group(1);
20: }
21:
22: public String render() throws Exception {
23: return HtmlUtil.metaText("fixture: " + getText());
24: }
25:
26: public String asWikiText() throws Exception {
27: return "!fixture " + this.text;
28: }
29: }
|