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) {
|
||||
let preparedText = text;
|
||||
if (clearText) {
|
||||
text = htmlToText.fromString (text, {
|
||||
preparedText = htmlToText.fromString (text, {
|
||||
wordwrap: false,
|
||||
ignoreHref: true,
|
||||
ignoreImage: true,
|
||||
});
|
||||
}
|
||||
|
||||
return summarizer (text, {n: length});
|
||||
return summarizer (preparedText, {n: length});
|
||||
};
|
||||
|
||||
getTitlesFromWP = function (sourceUrl) {
|
||||
|
||||
Reference in New Issue
Block a user