Bug 344991. Change accessors to return nsIFeedTextConstructs. r=ben. missed this file
git-svn-id: svn://10.0.0.236/trunk@203439 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
bc8eb4285e
commit
9870606b31
@ -140,10 +140,17 @@ FeedWriter.prototype = {
|
|||||||
* The feed container
|
* The feed container
|
||||||
*/
|
*/
|
||||||
_setTitleText: function FW__setTitleText(container) {
|
_setTitleText: function FW__setTitleText(container) {
|
||||||
this._setContentText("feedTitleText", container.title);
|
|
||||||
this._setContentText("feedSubtitleText",
|
LOG(container);
|
||||||
this._getPropertyAsString(container, "description"));
|
|
||||||
this._document.title = container.title;
|
if(container.title) {
|
||||||
|
this._setContentText("feedTitleText", container.title.plainText());
|
||||||
|
this._document.title = container.title.plainText();
|
||||||
|
}
|
||||||
|
|
||||||
|
var feed = container.QueryInterface(Ci.nsIFeed);
|
||||||
|
if(feed && feed.subtitle)
|
||||||
|
this._setContentText("feedSubtitleText", container.subtitle.plainText());
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -201,8 +208,10 @@ FeedWriter.prototype = {
|
|||||||
var entryContainer = this._document.createElementNS(HTML_NS, "div");
|
var entryContainer = this._document.createElementNS(HTML_NS, "div");
|
||||||
entryContainer.className = "entry";
|
entryContainer.className = "entry";
|
||||||
|
|
||||||
|
// If the entry has a title, make it a like
|
||||||
|
if (entry.title) {
|
||||||
var a = this._document.createElementNS(HTML_NS, "a");
|
var a = this._document.createElementNS(HTML_NS, "a");
|
||||||
a.appendChild(this._document.createTextNode(entry.title));
|
a.appendChild(this._document.createTextNode(entry.title.plainText()));
|
||||||
|
|
||||||
// Entries are not required to have links, so entry.link can be null.
|
// Entries are not required to have links, so entry.link can be null.
|
||||||
if (entry.link)
|
if (entry.link)
|
||||||
@ -211,15 +220,31 @@ FeedWriter.prototype = {
|
|||||||
var title = this._document.createElementNS(HTML_NS, "h3");
|
var title = this._document.createElementNS(HTML_NS, "h3");
|
||||||
title.appendChild(a);
|
title.appendChild(a);
|
||||||
entryContainer.appendChild(title);
|
entryContainer.appendChild(title);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var body = this._document.createElementNS(HTML_NS, "p");
|
var body = this._document.createElementNS(HTML_NS, "p");
|
||||||
var summary = entry.summary(true)
|
var summary = entry.summary || entry.content;
|
||||||
|
if (summary)
|
||||||
|
summary = summary.plainText();
|
||||||
if (summary && summary.length > MAX_CHARS)
|
if (summary && summary.length > MAX_CHARS)
|
||||||
summary = summary.substring(0, MAX_CHARS) + "...";
|
summary = summary.substring(0, MAX_CHARS) + "...";
|
||||||
|
|
||||||
// XXXben - Change to use innerHTML
|
// XXXben - Change to use innerHTML
|
||||||
body.appendChild(this._document.createTextNode(summary));
|
body.appendChild(this._document.createTextNode(summary));
|
||||||
body.className = "feedEntryContent";
|
body.className = "feedEntryContent";
|
||||||
|
|
||||||
|
// If the entry doesn't have a title, append a # permalink
|
||||||
|
// See http://scripting.com/rss.xml for an example
|
||||||
|
if (!entry.title && entry.link) {
|
||||||
|
var a = this._document.createElementNS(HTML_NS, "a");
|
||||||
|
a.appendChild(this._document.createTextNode("#"));
|
||||||
|
this._safeSetURIAttribute(a, "href", entry.link.spec);
|
||||||
|
body.appendChild(this._document.createTextNode(" "));
|
||||||
|
body.appendChild(a);
|
||||||
|
}
|
||||||
|
|
||||||
entryContainer.appendChild(body);
|
entryContainer.appendChild(body);
|
||||||
|
|
||||||
feedContent.appendChild(entryContainer);
|
feedContent.appendChild(entryContainer);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user