From 7cf8ea2d9817e729af3a5596c34bee17a2bfe163 Mon Sep 17 00:00:00 2001 From: Goraf <22941576+Goraf@users.noreply.github.com> Date: Tue, 5 Dec 2017 22:16:03 +0100 Subject: lpgen.js: Strip comments from 'version' files (#990) --- tools/lpgen/lpgen.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tools/lpgen') diff --git a/tools/lpgen/lpgen.js b/tools/lpgen/lpgen.js index d73fc6a819..90a6ce26aa 100644 --- a/tools/lpgen/lpgen.js +++ b/tools/lpgen/lpgen.js @@ -496,12 +496,15 @@ if (!test1 && !test2 && !test3 && !test4) { function ReadWholeFile(path, codepage) { if (codepage === undefined) codepage = "UTF-8"; - var bs = WScript.CreateObject("ADODB.Stream") + var bs = WScript.CreateObject("ADODB.Stream"); bs.Type = 2; //FileReadTypes.adTypeText; bs.CharSet = codepage; bs.Open(); bs.LoadFromFile(path); var what = bs.ReadText; + //remove all comments. The text starting with \\ (but not with ":\\" it's a links like https://miranda-ng.org/ and ")//" -there is one comment right after needed string) + //and remove multi-line comments, started with /* and ended with */ + what = what.replace(/(?:[^\):])(\/{2}.+?(?=$))|(\s\/\*[\S\s]+?\*\/)/mg,"."); bs.Close(); return what; } -- cgit v1.2.3