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.*;
06: import fitnesse.html.HtmlUtil;
07:
08: public class MetaWidget extends ParentWidget {
09: public static final String REGEXP = "^!meta [^\r\n]*";
10:
11: private static final Pattern pattern = Pattern
12: .compile("^!meta (.*)");
13:
14: private String content;
15:
16: public MetaWidget(ParentWidget parent, String text)
17: throws Exception {
18: super (parent);
19: Matcher match = pattern.matcher(text);
20: if (match.find())
21: setContent(match.group(1));
22: }
23:
24: private void setContent(String content) throws Exception {
25: this .content = content;
26: addChildWidgets(this .content);
27: }
28:
29: public String render() throws Exception {
30: return HtmlUtil.metaText(childHtml());
31: }
32:
33: public String asWikiText() throws Exception {
34: return "!meta " + content;
35: }
36: }
|