Mercurial > public > html2wiki
view src/org/nwoca/ssdt/tools/html2wiki/PreTagTransformer.java @ 7:a634b4d554d4
Minor fixups >, random smilies :), etc. Fixed blockquote. Handle escaping brackets outside pre tag.
author | smith@nwoca.org |
---|---|
date | Thu, 27 Jan 2011 18:07:28 -0500 |
parents | f8b1ea49d065 |
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"; } }