I am such a useless bitch.

This commit is contained in:
polecat
2005-12-04 17:04:10 +00:00
committed by zzz
parent 99951bf815
commit 5faca98176
5 changed files with 24 additions and 54 deletions

View File

@@ -88,22 +88,13 @@ public class HTMLPreviewRenderer extends HTMLRenderer {
for (int i = 0; i < _links.size(); i++) {
Link l = (Link)_links.get(i);
String schema = l.schema;
_postBodyBuffer.append("<p>Schema: ").append(schema).append("</p>");
_postBodyBuffer.append("<a ");
if(schema.equals("attachment")) {
/* No need for externallink double checker */
int ID = Integer.parseInt(l.location);
_postBodyBuffer.append("href=\"").append(getAttachmentURL(ID));
_postBodyBuffer.append("\">").append(sanitizeString(l.location));
} else {
_postBodyBuffer.append(getClass("summDetailExternalLink")).append(" href=\"externallink.jsp?");
if (l.schema != null)
_postBodyBuffer.append("schema=").append(sanitizeURL(l.schema)).append('&');
if (l.location != null)
_postBodyBuffer.append(getClass("summDetailExternalLink")).append(" href=\"externallink.jsp?");
if (l.schema != null)
_postBodyBuffer.append("schema=").append(sanitizeURL(l.schema)).append('&');
if (l.location != null)
_postBodyBuffer.append("location=").append(sanitizeURL(l.location)).append('&');
_postBodyBuffer.append("\">").append(sanitizeString(l.location));
}
_postBodyBuffer.append("\">").append(sanitizeString(l.location));
_postBodyBuffer.append(getSpan("summDetailExternalNet")).append(" (").append(sanitizeString(l.schema)).append(")</span></a> ");
}
_postBodyBuffer.append("<br />\n");

View File

@@ -437,16 +437,10 @@ public class HTMLRenderer extends EventReceiverImpl {
if (!continueBody()) { return; }
if ( (schema == null) || (location == null) ) return;
_bodyBuffer.append("<a ");
if ( schema.equals("attachment") ) {
int attachmentID = Integer.parseInt(location);
_bodyBuffer.append("href=\"").
append(getAttachmentURL(attachmentID));
} else {
_bodyBuffer.append(getClass("externalLink")).append(" href=\"externallink.jsp?schema=");
_bodyBuffer.append(sanitizeURL(schema)).append("&location=");
_bodyBuffer.append(sanitizeURL(location)).append("&description=");
_bodyBuffer.append(sanitizeURL(text));
}
_bodyBuffer.append(getClass("externalLink")).append(" href=\"externallink.jsp?schema=");
_bodyBuffer.append(sanitizeURL(schema)).append("&location=");
_bodyBuffer.append(sanitizeURL(location)).append("&description=");
_bodyBuffer.append(sanitizeURL(text));
_bodyBuffer.append("\">").
append(sanitizeString(text)).
append("</a>");
@@ -651,19 +645,12 @@ public class HTMLRenderer extends EventReceiverImpl {
Link l = (Link)_links.get(i);
String schema = l.schema;
_postBodyBuffer.append("<a ");
if(schema.equals("attachment")) {
/* No need for externallink double checker */
int ID = Integer.parseInt(l.location);
_postBodyBuffer.append(" href=\"").append(getAttachmentURL(ID));
_postBodyBuffer.append("\">").append(sanitizeString(l.location));
} else {
_postBodyBuffer.append(getClass("summDetailExternalLink")).append(" href=\"externallink.jsp?");
if (l.schema != null)
_postBodyBuffer.append("schema=").append(sanitizeURL(l.schema)).append('&');
if (l.location != null)
_postBodyBuffer.append("location=").append(sanitizeURL(l.location)).append('&');
_postBodyBuffer.append("\">").append(sanitizeString(l.location));
}
_postBodyBuffer.append(getClass("summDetailExternalLink")).append(" href=\"externallink.jsp?");
if (l.schema != null)
_postBodyBuffer.append("schema=").append(sanitizeURL(l.schema)).append('&');
if (l.location != null)
_postBodyBuffer.append("location=").append(sanitizeURL(l.location)).append('&');
_postBodyBuffer.append("\">").append(sanitizeString(l.location));
_postBodyBuffer.append(getSpan("summDetailExternalNet")).append(" (").append(sanitizeString(l.schema)).append(")</span></a> ");
}
_postBodyBuffer.append("<br />\n");

View File

@@ -314,4 +314,4 @@ public class RSSRenderer extends HTMLRenderer {
String sanitized = sanitizeXML(t);
System.out.println("[" + str + "] --> [" + sanitized + "]");
}
}
}

View File

@@ -406,21 +406,13 @@ public class ThreadedHTMLRenderer extends HTMLRenderer {
for (int i = 0; i < _links.size(); i++) {
Link l = (Link)_links.get(i);
String schema = l.schema;
_postBodyBuffer.append("<a ");
if(schema.equals("attachment")) {
/* No need for externallink double checker */
int ID = Integer.parseInt(l.location);
_postBodyBuffer.append(" href=\"").append(getAttachmentURL(ID));
_postBodyBuffer.append("\">").append(sanitizeString(l.location));
} else {
_postBodyBuffer.append(getClass("summDetailExternalLink")).append(" href=\"externallink.jsp?");
if (l.schema != null)
_postBodyBuffer.append("schema=").append(sanitizeURL(l.schema)).append('&');
if (l.location != null)
_postBodyBuffer.append("location=").append(sanitizeURL(l.location)).append('&');
_postBodyBuffer.append("\">").append(sanitizeString(l.location));
}
_postBodyBuffer.append("<a ");
_postBodyBuffer.append(getClass("summDetailExternalLink")).append(" href=\"externallink.jsp?");
if (l.schema != null)
_postBodyBuffer.append("schema=").append(sanitizeURL(l.schema)).append('&');
if (l.location != null)
_postBodyBuffer.append("location=").append(sanitizeURL(l.location)).append('&');
_postBodyBuffer.append("\">").append(sanitizeString(l.location));
_postBodyBuffer.append(getSpan("summDetailExternalNet")).append(" (").append(sanitizeString(l.schema)).append(")</span></a> ");
}
_postBodyBuffer.append("<br />\n");

View File

@@ -17,7 +17,7 @@ request.setCharacterEncoding("UTF-8");
<li>[cut]more inside[/cut] = &lt;a href="#"&gt;more inside...&lt;/a&gt;</li>
<li>[quote][/quote] = Quoted text</li>
<li>[img attachment="1"]alt[/img] = use attachment 1 as an image with 'alt' as the alt text</li>
<li>[link schema="attachment" location="0"]text[/link] = offer a link to one of the attachments in your post (redundant, but useful in context sometimes)
<li>[attachment id="0"]text[/attachment] = offer the attachment as a link in your post
<li>[link schema="eep" location="http://forum.i2p"]text[/link] = offer a link to an external resource (accessible with the given schema)</li>
<li>[blog name="name" bloghash="base64hash"]description[/blog] = link to all posts in the blog</li>
<li>[blog name="name" bloghash="base64hash" blogentry="1234"]description[/blog] = link to the specified post in the blog</li>