mta-wiki-parser
Version:
Wiki to Discord parser for Multi Theft Auto Wiki: https://wiki.multitheftauto.com/
24 lines (23 loc) • 664 B
JavaScript
;
/* Deprecated Template:
1. TEXT for the note
*/
// {{Note|TEXT for the note}}
Object.defineProperty(exports, "__esModule", { value: true });
const REGEX = /{{Note\|(.*?)}}/g;
function parse(input) {
// Parse template
input = input.replace(REGEX, (match, p1) => {
let parsed = '**Note**: ';
for (const [i, line] of p1.split('|').entries()) {
switch (i + 1) {
case 1:
parsed = line.length > 0 ? `${parsed} ${line}` : parsed;
break;
}
}
return `${parsed}\n`;
});
return input;
}
exports.parse = parse;