Advertisement
duc-phan

Untitled

Dec 1st, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.70 KB | None | 0 0
  1. package fitnesse.wikitext.widgets;
  2.  
  3. import java.util.regex.*;
  4.  
  5. public class BoldWidget extends ParentWidget {
  6.     public static final String REGEXP = "'''.+?'''";
  7.     private static final Pattern pattern = Pattern.compile("'''(.+?)'''",
  8.             Pattern.MULTILINE + Pattern.DOTALL
  9.     );
  10.  
  11.     public BoldWidget(ParentWidget parent, String text) throws Exception {
  12.         super(parent);
  13.         Matcher match = pattern.matcher(text);
  14.         match.find();
  15.         addChildWidgets(match.group(1));
  16.     }
  17.    
  18.     public String render() throws Exception {
  19.         StringBuffer html = new StringBuffer("<b>");
  20.         html.append(childHtml()).append("</b>");
  21.         return html.toString();
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement