@Test public void testWriteMatch() throws IOException { StringBuilder sb = new StringBuilder(); HistoryContext.writeMatch(sb, "foo", 0, 3, true, "/foo bar/haf+haf", "ctx", "1", "2"); Assert.assertEquals("<a href=\"ctx/diff/foo%20bar/haf%2Bhaf?r2=/foo%20bar/haf%2Bhaf@2&amp;" + "r1=/foo%20bar/haf%2Bhaf@1\" title=\"diff to previous version\">diff</a> <b>foo</b>", sb.toString()); }
protected static void writeMatch(Appendable out, String line, int start, int end, boolean flatten, String path, String wcontext, String nrev, String rev) throws IOException { String prefix = line.substring(0, start); String match = line.substring(start, end); String suffix = line.substring(end); if (wcontext != null && nrev != null && !wcontext.isEmpty()) { out.append("<a href=\""); printHTML(out, wcontext + Prefix.DIFF_P + Util.URIEncodePath(path) + "?" + QueryParameters.REVISION_2_PARAM_EQ + Util.URIEncodePath(path) + "@" + rev + "&" + QueryParameters.REVISION_1_PARAM_EQ + Util.URIEncodePath(path) + "@" + nrev + "\" title=\"diff to previous version\"", flatten); out.append(">diff</a> "); } printHTML(out, prefix, flatten); out.append("<b>"); printHTML(out, match, flatten); out.append("</b>"); printHTML(out, suffix, flatten); }
HistoryContext { protected static void writeMatch(Appendable out, String line, int start, int end, boolean flatten, String path, String wcontext, String nrev, String rev) throws IOException { String prefix = line.substring(0, start); String match = line.substring(start, end); String suffix = line.substring(end); if (wcontext != null && nrev != null && !wcontext.isEmpty()) { out.append("<a href=\""); printHTML(out, wcontext + Prefix.DIFF_P + Util.URIEncodePath(path) + "?" + QueryParameters.REVISION_2_PARAM_EQ + Util.URIEncodePath(path) + "@" + rev + "&" + QueryParameters.REVISION_1_PARAM_EQ + Util.URIEncodePath(path) + "@" + nrev + "\" title=\"diff to previous version\"", flatten); out.append(">diff</a> "); } printHTML(out, prefix, flatten); out.append("<b>"); printHTML(out, match, flatten); out.append("</b>"); printHTML(out, suffix, flatten); } }
HistoryContext { protected static void writeMatch(Appendable out, String line, int start, int end, boolean flatten, String path, String wcontext, String nrev, String rev) throws IOException { String prefix = line.substring(0, start); String match = line.substring(start, end); String suffix = line.substring(end); if (wcontext != null && nrev != null && !wcontext.isEmpty()) { out.append("<a href=\""); printHTML(out, wcontext + Prefix.DIFF_P + Util.URIEncodePath(path) + "?" + QueryParameters.REVISION_2_PARAM_EQ + Util.URIEncodePath(path) + "@" + rev + "&" + QueryParameters.REVISION_1_PARAM_EQ + Util.URIEncodePath(path) + "@" + nrev + "\" title=\"diff to previous version\"", flatten); out.append(">diff</a> "); } printHTML(out, prefix, flatten); out.append("<b>"); printHTML(out, match, flatten); out.append("</b>"); printHTML(out, suffix, flatten); } HistoryContext(Query query); }
HistoryContext { protected static void writeMatch(Appendable out, String line, int start, int end, boolean flatten, String path, String wcontext, String nrev, String rev) throws IOException { String prefix = line.substring(0, start); String match = line.substring(start, end); String suffix = line.substring(end); if (wcontext != null && nrev != null && !wcontext.isEmpty()) { out.append("<a href=\""); printHTML(out, wcontext + Prefix.DIFF_P + Util.URIEncodePath(path) + "?" + QueryParameters.REVISION_2_PARAM_EQ + Util.URIEncodePath(path) + "@" + rev + "&" + QueryParameters.REVISION_1_PARAM_EQ + Util.URIEncodePath(path) + "@" + nrev + "\" title=\"diff to previous version\"", flatten); out.append(">diff</a> "); } printHTML(out, prefix, flatten); out.append("<b>"); printHTML(out, match, flatten); out.append("</b>"); printHTML(out, suffix, flatten); } HistoryContext(Query query); boolean isEmpty(); boolean getContext(String filename, String path, List<Hit> hits); boolean getContext(String parent, String basename, String path, Writer out, String context); boolean getContext(File src, String path, Writer out, String context); }
HistoryContext { protected static void writeMatch(Appendable out, String line, int start, int end, boolean flatten, String path, String wcontext, String nrev, String rev) throws IOException { String prefix = line.substring(0, start); String match = line.substring(start, end); String suffix = line.substring(end); if (wcontext != null && nrev != null && !wcontext.isEmpty()) { out.append("<a href=\""); printHTML(out, wcontext + Prefix.DIFF_P + Util.URIEncodePath(path) + "?" + QueryParameters.REVISION_2_PARAM_EQ + Util.URIEncodePath(path) + "@" + rev + "&" + QueryParameters.REVISION_1_PARAM_EQ + Util.URIEncodePath(path) + "@" + nrev + "\" title=\"diff to previous version\"", flatten); out.append(">diff</a> "); } printHTML(out, prefix, flatten); out.append("<b>"); printHTML(out, match, flatten); out.append("</b>"); printHTML(out, suffix, flatten); } HistoryContext(Query query); boolean isEmpty(); boolean getContext(String filename, String path, List<Hit> hits); boolean getContext(String parent, String basename, String path, Writer out, String context); boolean getContext(File src, String path, Writer out, String context);  }