You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-12-17 23:27:48 +02:00
First pass at linting lib dir
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
const urlUtils = require('lib/urlUtils.js');
|
||||
const Entities = require('html-entities').AllHtmlEntities;
|
||||
const htmlentities = (new Entities()).encode;
|
||||
const htmlentities = new Entities().encode;
|
||||
|
||||
// [\s\S] instead of . for multiline matching
|
||||
// https://stackoverflow.com/a/16119722/561309
|
||||
const imageRegex = /<img([\s\S]*?)src=["']([\s\S]*?)["']([\s\S]*?)>/gi
|
||||
const anchorRegex = /<a([\s\S]*?)href=["']([\s\S]*?)["']([\s\S]*?)>/gi
|
||||
const imageRegex = /<img([\s\S]*?)src=["']([\s\S]*?)["']([\s\S]*?)>/gi;
|
||||
const anchorRegex = /<a([\s\S]*?)href=["']([\s\S]*?)["']([\s\S]*?)>/gi;
|
||||
|
||||
class HtmlUtils {
|
||||
|
||||
headAndBodyHtml(doc) {
|
||||
const output = [];
|
||||
if (doc.head) output.push(doc.head.innerHTML);
|
||||
@@ -21,7 +20,7 @@ class HtmlUtils {
|
||||
|
||||
const output = [];
|
||||
let matches;
|
||||
while (matches = imageRegex.exec(html)) {
|
||||
while ((matches = imageRegex.exec(html))) {
|
||||
output.push(matches[2]);
|
||||
}
|
||||
|
||||
@@ -84,9 +83,8 @@ class HtmlUtils {
|
||||
|
||||
return output.join(' ');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const htmlUtils = new HtmlUtils();
|
||||
|
||||
module.exports = htmlUtils;
|
||||
module.exports = htmlUtils;
|
||||
|
||||
Reference in New Issue
Block a user