Mercurial > public > html2wiki
view src/org/nwoca/ssdt/tools/html2wiki/DeleteTransformer.java @ 0:f8b1ea49d065
Initial version of crude HTML to WikiText converter. Customized for converting HTML files from DEC Document into Wiki markup.
author | smith@nwoca.org |
---|---|
date | Fri, 12 May 2006 16:45:42 -0400 |
parents | |
children |
line wrap: on
line source
package org.nwoca.ssdt.tools.html2wiki; import java.util.regex.*; class DeleteTransformer implements Transformer { private Pattern delete; public DeleteTransformer(String regex, boolean multiLine) { delete = Pattern.compile(regex, multiLine ? Pattern.MULTILINE : 0); } public DeleteTransformer(String regex) { this(regex,false); } public void apply(StringBuffer buffer) { Matcher matcher = delete.matcher(buffer); boolean first = true; while (matcher.find(first ? 0 : matcher.start() )) { buffer.delete(matcher.start(),matcher.end()); first = false; } } public String toString() { return "Delete: " + delete.pattern(); } }