Merge pull request #224 from afanjul/master
RSS Improvements to allow more template tags
This commit is contained in:
commit
d555ca44ac
2 changed files with 8 additions and 3 deletions
|
@ -50,7 +50,9 @@ module.exports.fetch = (url, callback) => {
|
||||||
date: item.date || item.pubdate || item.pubDate || new Date(),
|
date: item.date || item.pubdate || item.pubDate || new Date(),
|
||||||
guid: item.guid || item.link,
|
guid: item.guid || item.link,
|
||||||
link: item.link,
|
link: item.link,
|
||||||
content: item.description || item.summary
|
content: item.description || item.summary,
|
||||||
|
summary: item.summary || item.description,
|
||||||
|
image_url: item.image.url,
|
||||||
};
|
};
|
||||||
entries.push(entry);
|
entries.push(entry);
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,8 +132,11 @@ function checkEntries(parent, entries, callback) {
|
||||||
let entryId = result.insertId;
|
let entryId = result.insertId;
|
||||||
let html = (parent.html || '').toString().trim();
|
let html = (parent.html || '').toString().trim();
|
||||||
|
|
||||||
if (/\[RSS_ENTRY\]/i.test(html)) {
|
if (/\[RSS_ENTRY[\w]*\]/i.test(html)) {
|
||||||
html = html.replace(/\[RSS_ENTRY\]/, entry.content);
|
html = html.replace(/\[RSS_ENTRY\]/, entry.content); //for backward compatibility
|
||||||
|
Object.keys(entry).forEach(key => {
|
||||||
|
html = html.replace('\[RSS_ENTRY_'+key.toUpperCase()+'\]', entry[key])
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
html = entry.content + html;
|
html = entry.content + html;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue