|
|
@ -7,6 +7,8 @@
|
|
|
|
const path = require('path');
|
|
|
|
const path = require('path');
|
|
|
|
const pug = require('pug');
|
|
|
|
const pug = require('pug');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const striptags = require('striptags');
|
|
|
|
|
|
|
|
|
|
|
|
const { SiteLog } = require(path.join(__dirname, 'site-log'));
|
|
|
|
const { SiteLog } = require(path.join(__dirname, 'site-log'));
|
|
|
|
const { SiteAsync } = require(path.join(__dirname, 'site-async'));
|
|
|
|
const { SiteAsync } = require(path.join(__dirname, 'site-async'));
|
|
|
|
|
|
|
|
|
|
|
@ -102,6 +104,25 @@ class SiteCommon extends Events {
|
|
|
|
}, options);
|
|
|
|
}, options);
|
|
|
|
return pug.compileFileClient(scriptFile, options);
|
|
|
|
return pug.compileFileClient(scriptFile, options);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
parseTagList (tagList, options) {
|
|
|
|
|
|
|
|
options = Object.assign({
|
|
|
|
|
|
|
|
lowercase: true,
|
|
|
|
|
|
|
|
filter: [ ],
|
|
|
|
|
|
|
|
}, options);
|
|
|
|
|
|
|
|
return tagList
|
|
|
|
|
|
|
|
.split(',')
|
|
|
|
|
|
|
|
.map((metric) => {
|
|
|
|
|
|
|
|
metric = striptags(metric.trim());
|
|
|
|
|
|
|
|
return options.lowercase ? metric.toLowerCase() : metric;
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.filter((metric) => {
|
|
|
|
|
|
|
|
return (typeof metric === 'string') &&
|
|
|
|
|
|
|
|
(metric.length > 0) &&
|
|
|
|
|
|
|
|
!options.filter.includes(metric.toLowerCase())
|
|
|
|
|
|
|
|
;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
module.exports.SiteCommon = SiteCommon;
|
|
|
|
module.exports.SiteCommon = SiteCommon;
|