1 25 26 package org.snipsnap.render.filter; 27 28 import org.radeox.filter.regex.RegexTokenFilter; 29 import org.radeox.regex.MatchResult; 30 import org.radeox.filter.context.FilterContext; 31 import org.radeox.util.StringBufferWriter; 32 import org.snipsnap.render.filter.context.SnipFilterContext; 33 import org.snipsnap.snip.Snip; 34 import org.snipsnap.snip.SnipLink; 35 36 import java.io.IOException ; 37 import java.io.Writer ; 38 39 48 49 public class PgpFilter extends RegexTokenFilter { 50 51 public PgpFilter() { 52 super("--PGP SIGNED--", SINGLELINE); 53 } 54 55 public void handleMatch(StringBuffer buffer, MatchResult result, FilterContext context) { 56 Snip snip = ((SnipFilterContext) context).getSnip(); 57 Writer writer = new StringBufferWriter(buffer); 58 try { 59 SnipLink.appendImage(writer, "Icon-Key", ""); 60 writer.write(result.group(0)); 61 } catch (IOException e) { 62 } 64 } 65 } 66 | Popular Tags |