- * <copy file="${src.file}" tofile="${dest.file}">
- * <filterchain>
- * <filterreader classname="org.markdownj.MarkdownFilter"/>
- * </filterchain>
- * </copy>
- *
- * @author Marty Lamb
- */
-public class MarkdownFilter extends BaseParamFilterReader implements ChainableReader {
-
- /**
- * Stores the characters post markdown
- */
- char[] chars = null;
-
- /**
- * The index of the next character to return
- */
- int pos = 0;
-
- /**
- * The number of characters in the array (avoid repeated chars.length calls)
- */
- int len = 0;
-
- /**
- * Constructor for "dummy" instances.
- *
- * @see org.apache.tools.ant.filters.BaseFilterReader#BaseFilterReader()
- */
- public MarkdownFilter() {
- super();
- }
-
- /**
- * Creates a new filtered reader.
- *
- * @param in A Reader object providing the underlying stream.
- * Must not be null
.
- */
- public MarkdownFilter(Reader reader) {
- super(reader);
- }
-
- /**
- * Creates a new MarkdownFilter using the passed in
- * Reader for instantiation.
- *
- * @param rdr A Reader object providing the underlying stream.
- * Must not be null
.
- *
- * @return a new filter based on this configuration, but filtering
- * the specified reader
- */
- public Reader chain(Reader reader) {
- MarkdownFilter result = new MarkdownFilter(reader);
- result.setParameters(this.getParameters());
- return (result);
- }
-
- /**
- * Returns the next character in the filtered stream, after performing
- * the Markdown processing
- *
- * @return the next character in the resulting stream, or -1
- * if the end of the resulting stream has been reached
- *
- * @exception IOException if the underlying stream throws an IOException
- * during reading
- */
- @Override
- public final int read() throws java.io.IOException {
-
- if (chars == null) {
- char[] cbuf = new char[1024];
- StringBuffer buf = new StringBuffer();
- int charsRead = in.read(cbuf);
- while (charsRead >= 0) {
- buf.append(cbuf, 0, charsRead);
- charsRead = in.read(cbuf);
- }
- MarkdownProcessor markdown = new MarkdownProcessor();
- chars = markdown.markdown(buf.toString()).toCharArray();
- len = chars.length;
- }
-
- return (pos >= len ? -1 : chars[pos++]);
- }
-}
diff --git a/pom.xml b/pom.xml
index 2366d31..d287a91 100644
--- a/pom.xml
+++ b/pom.xml
@@ -242,8 +242,6 @@ software, even if advised of the possibility of such damage.
HTML Source:
-HTML Preview:
-