Mercurial > public > html2wiki
view src/org/nwoca/ssdt/tools/html2wiki/PreTagTransformer.java @ 8:e8ea26ab2cd7
[no commit message]
author | ferrall@nwoca.org |
---|---|
date | Fri, 28 Jan 2011 08:20:29 -0500 |
parents | a634b4d554d4 |
children |
line wrap: on
line source
package org.nwoca.ssdt.tools.html2wiki; import java.util.regex.*; class PreTagTransformer implements Transformer { private Pattern pattern = Pattern.compile("<pre>.*?</pre>",Pattern.MULTILINE + Pattern.DOTALL); public PreTagTransformer() { } public void apply(StringBuffer buffer) { Matcher matcher = pattern.matcher(buffer); boolean first = true; while (matcher.find( first ? 0 : matcher.end())) { String temp = buffer.substring(matcher.start(),matcher.end()); temp = temp.replaceAll("\\\\\\[","["); temp = temp.replaceAll("\\\\\\]","]"); buffer.replace(matcher.start(),matcher.end(),temp); first = false; } } public String toString() { return "Unescaping Pre tag contents"; } }