Created
April 17, 2020 02:06
-
-
Save Ralireza/e53ac900f8fbba03e4902b62b082b340 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package fitnesse.wikitext.widgets; | |
import java.util.regex.*; | |
public class BoldWidget extends ParentWidget { | |
public static final String REGEXP = "'''.+?'''"; | |
private static final Pattern pattern = Pattern.compile("'''(.+?)'''", | |
Pattern.MULTILINE + Pattern.DOTALL); | |
public BoldWidget(ParentWidget parent, String text) throws Exception { | |
super(parent); | |
Matcher match = pattern.matcher(text); match.find(); addChildWidgets(match.group(1)); | |
} | |
public String render() throws Exception { | |
StringBuffer html = new StringBuffer("<b>"); | |
html.append(childHtml()).append("</b>"); | |
return html.toString(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment