reallysimple 0.4.14 → 0.4.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -1
- package/reallysimple.js +22 -3
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reallysimple",
|
|
3
3
|
"description": "A Node package that reads RSS-like feeds and calls back with a simple, consistent JavaScript object. Easy to use, hides the history.",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.17",
|
|
5
5
|
"author": "Dave Winer <dave@scripting.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"files": [
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
"url": "https://github.com/scripting/reallysimple.git"
|
|
14
14
|
},
|
|
15
15
|
"dependencies" : {
|
|
16
|
+
"marked": "*",
|
|
17
|
+
"node-emoji": "*",
|
|
16
18
|
"opml": "*",
|
|
17
19
|
"daveutils": "*",
|
|
18
20
|
"davefeedread": "*"
|
package/reallysimple.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var myProductName = "reallysimple", myVersion = "0.4.
|
|
1
|
+
var myProductName = "reallysimple", myVersion = "0.4.17";
|
|
2
2
|
|
|
3
3
|
exports.readFeed = readFeed;
|
|
4
4
|
exports.convertFeedToOpml = convertFeedToOpml;
|
|
@@ -6,8 +6,11 @@ exports.setConfig = setConfig; //6/23/22 by DW
|
|
|
6
6
|
|
|
7
7
|
const utils = require ("daveutils");
|
|
8
8
|
const request = require ("request");
|
|
9
|
+
const process = require ("process");
|
|
9
10
|
const opml = require ("opml");
|
|
10
11
|
const davefeedread = require ("davefeedread");
|
|
12
|
+
const marked = require ("marked"); //7/18/22 by DW
|
|
13
|
+
const emoji = require ("node-emoji"); //7/18/22 by DW
|
|
11
14
|
|
|
12
15
|
const allowedHeadNames = [
|
|
13
16
|
"title", "link", "description", "language", "copyright", "managingEditor", "webMaster", "lastBuildDate", "pubDate", "category",
|
|
@@ -57,6 +60,17 @@ function getItemPermalink (item) {
|
|
|
57
60
|
}
|
|
58
61
|
return (undefined);
|
|
59
62
|
}
|
|
63
|
+
function markdownProcess (markdowntext) {
|
|
64
|
+
var htmltext = marked.parse (markdowntext);
|
|
65
|
+
return (htmltext);
|
|
66
|
+
}
|
|
67
|
+
function emojiProcess (s) {
|
|
68
|
+
function addSpan (code, name) {
|
|
69
|
+
return ("<span class=\"spRssEmoji\">" + code + "</span>");
|
|
70
|
+
}
|
|
71
|
+
return (emoji.emojify (s, undefined, addSpan));
|
|
72
|
+
}
|
|
73
|
+
|
|
60
74
|
function convertFeedToOpml (theFeed) { //use this if you want to show an RSS feed in an outline
|
|
61
75
|
var theOutline = {
|
|
62
76
|
opml: {
|
|
@@ -175,7 +189,7 @@ function convertFeed (oldFeed, whenstart) {
|
|
|
175
189
|
}
|
|
176
190
|
|
|
177
191
|
newFeed.reader = { //7/2/22 by DW
|
|
178
|
-
app: myProductName + " v" + myVersion,
|
|
192
|
+
app: myProductName + " v" + myVersion + " (" + process.platform + ")",
|
|
179
193
|
ctSecsToRead: utils.secondsSince (whenstart)
|
|
180
194
|
};
|
|
181
195
|
|
|
@@ -206,7 +220,7 @@ function convertFeed (oldFeed, whenstart) {
|
|
|
206
220
|
});
|
|
207
221
|
}
|
|
208
222
|
}
|
|
209
|
-
newItem.
|
|
223
|
+
newItem.permalink = getItemPermalink (item); //7/14/22 by DW
|
|
210
224
|
if (newItem.source !== undefined) { //5/17/22 by DW
|
|
211
225
|
if (isEmptyObject (newItem.source)) {
|
|
212
226
|
delete newItem.source;
|
|
@@ -227,6 +241,11 @@ function convertFeed (oldFeed, whenstart) {
|
|
|
227
241
|
newItem.enclosure = enc;
|
|
228
242
|
}
|
|
229
243
|
|
|
244
|
+
if (item ["source:markdown"] !== undefined) { //7/18/22 by DW
|
|
245
|
+
let markdowntext = item ["source:markdown"] ["#"];
|
|
246
|
+
newItem.description = markdownProcess (emojiProcess (markdowntext));
|
|
247
|
+
}
|
|
248
|
+
|
|
230
249
|
newFeed.items.push (newItem);
|
|
231
250
|
});
|
|
232
251
|
|