From cd1a87b9f7c84a8a90971d6393f490347ad53aa4 Mon Sep 17 00:00:00 2001 From: f0x Date: Wed, 17 Feb 2021 21:03:13 +0100 Subject: [PATCH] adapt to new format --- fix.js | 38 +++++++++++++++++++++++++++++++++++++- yarn.lock | 5 ----- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/fix.js b/fix.js index 5bcd02b..46fcefe 100755 --- a/fix.js +++ b/fix.js @@ -3,6 +3,7 @@ "use strict"; const fs = require("fs"); +const os = require("os"); const chalk = require("chalk"); const path = require("path"); @@ -15,11 +16,46 @@ if (process.argv[2] == null) { let parsedPath = path.parse(absolutePath); delete parsedPath.base; - parsedPath.name += "-fixed"; + parsedPath.name += "-fixed2"; let fixedContents = contents.replace(/(^|\r\n-\r\n)ABNANL2A\r\n940\r\nABNANL2A\r\n/g, "$1"); let fixedFilename = path.format(parsedPath); + let lines = fixedContents.split(/\r?\n/); + let outputLines = []; + for (let i=0; i { + desc = desc.replace(repl,' '); + }) + desc = desc.replace("OMSCHRIJVING:",","); + outputLines.push(desc); + } else { + outputLines.push(line); + } + } + fixedContents = outputLines.join(os.EOL); + fs.writeFileSync(fixedFilename, fixedContents, { encoding: "utf8" }) console.log(file, "->", fixedFilename); diff --git a/yarn.lock b/yarn.lock index 2898cf5..366dc14 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9,11 +9,6 @@ ansi-styles@^3.2.1: dependencies: color-convert "^1.9.0" -bluebird@^3.5.5: - version "3.5.5" - resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.5.tgz#a8d0afd73251effbbd5fe384a77d73003c17a71f" - integrity sha512-5am6HnnfN+urzt4yfg7IgTbotDjIT/u8AJpEt0sIU9FtXfVeezXAPKswrG+xKUCOYAINpSdgZVDU6QFh+cuH3w== - chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"