[freenet-cvs] r12103 - trunk/plugins/Librarian
nextgens at freenetproject.org
nextgens at freenetproject.org
Mon Mar 12 22:39:17 UTC 2007
Author: nextgens
Date: 2007-03-12 22:39:15 +0000 (Mon, 12 Mar 2007)
New Revision: 12103
Modified:
trunk/plugins/Librarian/Librarian.java
Log:
plugins: Librarian: commit a patch from d9GkwkaB3 at KeopI7DuKVR5cMkVv6GG7mwT3X4 :
Modified: trunk/plugins/Librarian/Librarian.java
===================================================================
--- trunk/plugins/Librarian/Librarian.java 2007-03-12 14:32:33 UTC (rev 12102)
+++ trunk/plugins/Librarian/Librarian.java 2007-03-12 22:39:15 UTC (rev 12103)
@@ -241,16 +241,20 @@
URIWrapper o = (URIWrapper)it.next();
String showurl = o.URI;
+ String description = HTMLEncoder.encode(o.descr);
+ description=description.replaceAll("(\n|<(b|B)(r|R)>)", "<br>");
+ description=description.replaceAll(" ", " ");
+ description=description.replaceAll("</?[a-zA-Z].*/?>", "");
+ showurl = HTMLEncoder.encode(showurl);
if (showurl.length() > 60)
- showurl = showurl.substring(0,10) + "..." +
- showurl.substring(showurl.length()-45);
+ showurl = showurl.substring(0,15) + "…" +
+ showurl.replaceFirst("[^/]*/", "/");
String realurl = (o.URI.startsWith("/")?"":"/") + o.URI;
realurl = HTMLEncoder.encode(realurl);
- showurl = HTMLEncoder.encode(showurl);
- out.append("<table class=\"librarian-result\" width=\"100%\" border=1><tr><td align=center bgcolor=\"#D0D0D0\" class=\"librarian-result-url\">\n");
+ out.append("<p>\n<table class=\"librarian-result\" width=\"100%\" border=1><tr><td align=center bgcolor=\"#D0D0D0\" class=\"librarian-result-url\">\n");
out.append(" <A HREF=\"").append(realurl).append("\" title=\"").append(o.URI).append("\">").append(showurl).append("</A>\n");
out.append("</td></tr><tr><td align=left class=\"librarian-result-summary\">\n");
- out.append("<pre>").append(HTMLEncoder.encode(o.descr)).append("</pre>\n");
+ out.append("<tt>").append(description).append("</tt>\n");
out.append("</td></tr></table>\n");
results++;
}
More information about the cvs
mailing list