forked from I2P_Developers/i2p.i2p
Adding a schema for [link] to handle if you want to display links directly to your attachments within the context of the blog itself. Some redundant code here (3 files modified with cut & paste) so we may want to further abstract the External links: HTML generation code.
This commit is contained in:
@@ -87,12 +87,23 @@ public class HTMLPreviewRenderer extends HTMLRenderer {
|
||||
_postBodyBuffer.append(getSpan("summDetailExternal")).append("External links:</span> ");
|
||||
for (int i = 0; i < _links.size(); i++) {
|
||||
Link l = (Link)_links.get(i);
|
||||
_postBodyBuffer.append("<a ").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));
|
||||
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("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");
|
||||
|
||||
@@ -436,10 +436,20 @@ public class HTMLRenderer extends EventReceiverImpl {
|
||||
_links.add(l);
|
||||
if (!continueBody()) { return; }
|
||||
if ( (schema == null) || (location == null) ) return;
|
||||
_bodyBuffer.append("<a ").append(getClass("externalLink")).append(" href=\"externallink.jsp?schema=");
|
||||
_bodyBuffer.append(sanitizeURL(schema)).append("&location=");
|
||||
_bodyBuffer.append(sanitizeURL(location)).append("&description=");
|
||||
_bodyBuffer.append(sanitizeURL(text)).append("\">").append(sanitizeString(text)).append("</a>");
|
||||
_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("\">").
|
||||
append(sanitizeString(text)).
|
||||
append("</a>");
|
||||
}
|
||||
|
||||
protected static class Address {
|
||||
@@ -639,12 +649,21 @@ public class HTMLRenderer extends EventReceiverImpl {
|
||||
_postBodyBuffer.append(getSpan("summDetailExternal")).append("External links:</span> ");
|
||||
for (int i = 0; i < _links.size(); i++) {
|
||||
Link l = (Link)_links.get(i);
|
||||
_postBodyBuffer.append("<a ").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));
|
||||
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(getSpan("summDetailExternalNet")).append(" (").append(sanitizeString(l.schema)).append(")</span></a> ");
|
||||
}
|
||||
_postBodyBuffer.append("<br />\n");
|
||||
|
||||
@@ -405,12 +405,22 @@ public class ThreadedHTMLRenderer extends HTMLRenderer {
|
||||
_postBodyBuffer.append(getSpan("summDetailExternal")).append("External links:</span> ");
|
||||
for (int i = 0; i < _links.size(); i++) {
|
||||
Link l = (Link)_links.get(i);
|
||||
_postBodyBuffer.append("<a ").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, 60));
|
||||
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(getSpan("summDetailExternalNet")).append(" (").append(sanitizeString(l.schema)).append(")</span></a> ");
|
||||
}
|
||||
_postBodyBuffer.append("<br />\n");
|
||||
|
||||
@@ -17,11 +17,12 @@ request.setCharacterEncoding("UTF-8");
|
||||
<li>[cut]more inside[/cut] = <a href="#">more inside...</a></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>[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>
|
||||
<li>[blog name="name" bloghash="base64hash" blogtag="tag"]description[/blog] = link to all posts in the blog with the specified tag</li>
|
||||
<li>[blog name="name" blogtag="tag"]description[/blog] = link to all posts in all blogs with the specified tag</li>
|
||||
<li>[link schema="eep" location="http://forum.i2p"]text[/link] = offer a link to an external resource (accessible with the given schema)</li>
|
||||
<li>[archive name="name" description="they have good stuff" schema="eep" location="http://syndiemedia.i2p/archive/archive.txt"]foo![/archive] = offer an easy way to sync up with a new Syndie archive</li>
|
||||
</ul>
|
||||
SML headers are newline delimited key:value pairs. Example keys are:
|
||||
|
||||
Reference in New Issue
Block a user