Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // To add colour formatting to Dustloop wiki combos for GG Strive.
- // Requires: NodeJS v10+
- // How to use: node this-files-name.js path-to-input path-to-output
- function colourText(str){
- return moves.reduce((prev, curr, index) => {
- const patt = makePattern(curr, index+1);
- return prev.replace(patt.pattern, patt.replace);
- }, str);
- }
- const moves = ['P','K','S','H(S?)','D']
- function makePattern(move, num){
- return {
- pattern: new RegExp(`((([0-9\\[\\]]+)|((d)?j\\.[0-9\\[\\]]?)|(c\\.)|(f\\.))(\\[)?${move}(\\])?(\\s?\\([1-9]\\))?)`, 'ig'),
- replace: `{{clr|${num}|$1}}`
- };
- }
- const [inputFile, outputFile] = process.argv.slice(2,4);
- const fs = require('fs');
- const input = fs.readFileSync(inputFile).toString();
- fs.writeFileSync(outputFile, colourText(input));
- return;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement