forked from I2P_Developers/i2p.i2p
News:
- Fix retrieval of entry links from feed - Linkify entry headers
This commit is contained in:
@ -269,6 +269,7 @@ public class NewsManager implements RouterApp {
|
||||
return rv;
|
||||
}
|
||||
|
||||
/****
|
||||
public static void main(String[] args) {
|
||||
if (args.length != 0) {
|
||||
System.err.println("Usage: NewsManager");
|
||||
@ -281,7 +282,9 @@ public class NewsManager implements RouterApp {
|
||||
System.out.println("Loaded " + entries.size() + " news entries");
|
||||
for (int i = 0; i < entries.size(); i++) {
|
||||
NewsEntry e = entries.get(i);
|
||||
System.out.println("\n****** News #" + (i+1) + ": " + e.title + ' ' + new Date(e.updated) + '\n' + e.content);
|
||||
System.out.println("\n****** News #" + (i+1) + ": " + e.title + ' ' + new Date(e.updated) +
|
||||
"\nLink: " + e.link + '\n' + e.content);
|
||||
}
|
||||
}
|
||||
****/
|
||||
}
|
||||
|
@ -267,9 +267,9 @@ public class NewsXMLParser {
|
||||
}
|
||||
n = entry.getNode("link");
|
||||
if (n != null) {
|
||||
e.link = n.getValue();
|
||||
if (e.link != null)
|
||||
e.link = e.link.trim();
|
||||
String a = n.getAttributeValue("href");
|
||||
if (a.length() > 0)
|
||||
e.link = a.trim();
|
||||
}
|
||||
n = entry.getNode("id");
|
||||
if (n != null) {
|
||||
|
@ -155,9 +155,9 @@ class PersistNews {
|
||||
}
|
||||
n = entry.getNode("link");
|
||||
if (n != null) {
|
||||
e.link = n.getValue();
|
||||
if (e.link != null)
|
||||
e.link = e.link.trim();
|
||||
String a = n.getAttributeValue("href");
|
||||
if (a.length() > 0)
|
||||
e.link = a.trim();
|
||||
}
|
||||
n = entry.getNode("id");
|
||||
if (n != null) {
|
||||
@ -231,6 +231,7 @@ class PersistNews {
|
||||
return PFX + Base64.encode(hash) + SFX;
|
||||
}
|
||||
|
||||
/****
|
||||
public static void main(String[] args) {
|
||||
if (args.length != 1) {
|
||||
System.err.println("Usage: PersistNews file.xml");
|
||||
@ -262,4 +263,5 @@ class PersistNews {
|
||||
System.out.println("\n****** News #" + (i+1) + ": " + e.title + '\n' + e.content);
|
||||
}
|
||||
}
|
||||
****/
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import java.util.TimeZone;
|
||||
|
||||
import net.i2p.I2PAppContext;
|
||||
import net.i2p.app.ClientAppManager;
|
||||
import net.i2p.data.DataHelper;
|
||||
import net.i2p.router.news.NewsEntry;
|
||||
import net.i2p.router.news.NewsManager;
|
||||
|
||||
@ -68,8 +69,12 @@ public class NewsFeedHelper extends HelperBase {
|
||||
buf.append(fmt.format(date))
|
||||
.append(": ");
|
||||
}
|
||||
buf.append(entry.title)
|
||||
.append("</h3>\n<div class=\"newscontent\">\n")
|
||||
if (entry.link != null)
|
||||
buf.append("<a href=\"").append(DataHelper.escapeHTML(entry.link)).append("\">");
|
||||
buf.append(entry.title);
|
||||
if (entry.link != null)
|
||||
buf.append("</a>");
|
||||
buf.append("</h3>\n<div class=\"newscontent\">\n")
|
||||
.append(entry.content)
|
||||
.append("\n</div></div>\n");
|
||||
if (i >= start + max)
|
||||
|
Reference in New Issue
Block a user