@Test public void testMarkupChinese() throws Exception { char[] characterBuffer = "你也可以[定义新问题](%s)".toCharArray(); new MarkdownLinkFilterWriter(out, link).write(characterBuffer, 0, 15); Mockito.verify(out).write("你也可以<a href=\"createQuestion.ftl\">定义新问题</a>\n"); }
@Override public void write(char[] cbuf, int off, int len) throws IOException { StringBuffer slurped = new StringBuffer(); for (int i = 0; i < len; i++) { slurped.append(cbuf[i + off]); } String replaced = String.format(slurped.toString(), dest); String markedDown = new MarkdownProcessor().markdown(replaced); markedDown = markedDown.replace("<p>", ""); markedDown = markedDown.replace("</p>", ""); out.write(markedDown); }
MarkdownLinkFilterWriter extends Writer { @Override public void write(char[] cbuf, int off, int len) throws IOException { StringBuffer slurped = new StringBuffer(); for (int i = 0; i < len; i++) { slurped.append(cbuf[i + off]); } String replaced = String.format(slurped.toString(), dest); String markedDown = new MarkdownProcessor().markdown(replaced); markedDown = markedDown.replace("<p>", ""); markedDown = markedDown.replace("</p>", ""); out.write(markedDown); } }
MarkdownLinkFilterWriter extends Writer { @Override public void write(char[] cbuf, int off, int len) throws IOException { StringBuffer slurped = new StringBuffer(); for (int i = 0; i < len; i++) { slurped.append(cbuf[i + off]); } String replaced = String.format(slurped.toString(), dest); String markedDown = new MarkdownProcessor().markdown(replaced); markedDown = markedDown.replace("<p>", ""); markedDown = markedDown.replace("</p>", ""); out.write(markedDown); } MarkdownLinkFilterWriter(Writer out, String dest); }
MarkdownLinkFilterWriter extends Writer { @Override public void write(char[] cbuf, int off, int len) throws IOException { StringBuffer slurped = new StringBuffer(); for (int i = 0; i < len; i++) { slurped.append(cbuf[i + off]); } String replaced = String.format(slurped.toString(), dest); String markedDown = new MarkdownProcessor().markdown(replaced); markedDown = markedDown.replace("<p>", ""); markedDown = markedDown.replace("</p>", ""); out.write(markedDown); } MarkdownLinkFilterWriter(Writer out, String dest); @Override void write(char[] cbuf, int off, int len); @Override void flush(); @Override void close(); }
MarkdownLinkFilterWriter extends Writer { @Override public void write(char[] cbuf, int off, int len) throws IOException { StringBuffer slurped = new StringBuffer(); for (int i = 0; i < len; i++) { slurped.append(cbuf[i + off]); } String replaced = String.format(slurped.toString(), dest); String markedDown = new MarkdownProcessor().markdown(replaced); markedDown = markedDown.replace("<p>", ""); markedDown = markedDown.replace("</p>", ""); out.write(markedDown); } MarkdownLinkFilterWriter(Writer out, String dest); @Override void write(char[] cbuf, int off, int len); @Override void flush(); @Override void close();  }