improve code (comment from PR #17)
This commit is contained in:
@@ -28,15 +28,16 @@ getDataFromWPJSON = function (sourceUrl, page = 1, maxPosts = 10) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
summarizeText = function (text, length, clearText = true) {
|
summarizeText = function (text, length, clearText = true) {
|
||||||
|
let preparedText = text;
|
||||||
if (clearText) {
|
if (clearText) {
|
||||||
text = htmlToText.fromString (text, {
|
preparedText = htmlToText.fromString (text, {
|
||||||
wordwrap: false,
|
wordwrap: false,
|
||||||
ignoreHref: true,
|
ignoreHref: true,
|
||||||
ignoreImage: true,
|
ignoreImage: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return summarizer (text, {n: length});
|
return summarizer (preparedText, {n: length});
|
||||||
};
|
};
|
||||||
|
|
||||||
getTitlesFromWP = function (sourceUrl) {
|
getTitlesFromWP = function (sourceUrl) {
|
||||||
|
|||||||
Reference in New Issue
Block a user