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