mirror of
https://activitypub.software/TransFem-org/Sharkey
synced 2024-11-25 15:35:12 +00:00
✌️
This commit is contained in:
parent
b2368b04db
commit
90a4fe471d
3 changed files with 33 additions and 32 deletions
|
@ -209,7 +209,7 @@
|
|||
"vue-cropperjs": "2.2.0",
|
||||
"vue-js-modal": "1.3.13",
|
||||
"vue-json-tree-view": "2.1.4",
|
||||
"vue-loader": "15.0.5",
|
||||
"vue-loader": "15.0.11",
|
||||
"vue-router": "3.0.1",
|
||||
"vue-template-compiler": "2.5.16",
|
||||
"vuedraggable": "2.16.0",
|
||||
|
|
|
@ -146,27 +146,20 @@ module.exports = {
|
|||
}, {
|
||||
loader: 'replace',
|
||||
query: {
|
||||
search: /%base64:(.+?)%/g.toString(),
|
||||
replace: 'base64replacement'
|
||||
}
|
||||
}, {
|
||||
loader: 'replace',
|
||||
query: {
|
||||
search: i18nPattern.toString(),
|
||||
replace: 'i18nReplacement',
|
||||
i18n: true
|
||||
}
|
||||
}, {
|
||||
loader: 'replace',
|
||||
query: {
|
||||
search: faPattern.toString(),
|
||||
replace: 'faReplacement'
|
||||
}
|
||||
}, {
|
||||
loader: 'replace',
|
||||
query: {
|
||||
search: /^<template>([\s\S]+?)\r?\n<\/template>/.toString(),
|
||||
replace: 'collapseSpacesReplacement'
|
||||
qs: [{
|
||||
search: /%base64:(.+?)%/g.toString(),
|
||||
replace: 'base64replacement'
|
||||
}, {
|
||||
search: i18nPattern.toString(),
|
||||
replace: 'i18nReplacement',
|
||||
i18n: true
|
||||
}, {
|
||||
search: faPattern.toString(),
|
||||
replace: 'faReplacement'
|
||||
}, {
|
||||
search: /^<template>([\s\S]+?)\r?\n<\/template>/.toString(),
|
||||
replace: 'collapseSpacesReplacement'
|
||||
}]
|
||||
}
|
||||
}]
|
||||
}, {
|
||||
|
|
|
@ -5,18 +5,26 @@ function trim(text, g) {
|
|||
}
|
||||
|
||||
export default function(src) {
|
||||
const fn = options => {
|
||||
const search = options.search;
|
||||
const g = search[search.length - 1] == 'g';
|
||||
const file = this.resourcePath.replace(/\\/g, '/');
|
||||
const replace = options.i18n ? global[options.replace].bind(null, {
|
||||
src: file,
|
||||
lang: options.lang
|
||||
}) : global[options.replace];
|
||||
if (typeof search != 'string' || search.length == 0) console.error('invalid search');
|
||||
if (typeof replace != 'function') console.error('invalid replacer:', replace, this.request);
|
||||
src = src.replace(new RegExp(trim(search, g), g ? 'g' : ''), replace);
|
||||
};
|
||||
|
||||
this.cacheable();
|
||||
const options = getOptions(this);
|
||||
const search = options.search;
|
||||
const g = search[search.length - 1] == 'g';
|
||||
const file = this.resourcePath.replace(/\\/g, '/');
|
||||
const replace = options.i18n ? global[options.replace].bind(null, {
|
||||
src: file,
|
||||
lang: options.lang
|
||||
}) : global[options.replace];
|
||||
if (typeof search != 'string' || search.length == 0) console.error('invalid search');
|
||||
if (typeof replace != 'function') console.error('invalid replacer:', replace, this.request);
|
||||
src = src.replace(new RegExp(trim(search, g), g ? 'g' : ''), replace);
|
||||
if (options.qs) {
|
||||
options.qs.forEach(q => fn(q));
|
||||
} else {
|
||||
fn(options);
|
||||
}
|
||||
this.callback(null, src);
|
||||
return src;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue