diff options
author | Goraf <22941576+Goraf@users.noreply.github.com> | 2017-12-05 22:16:03 +0100 |
---|---|---|
committer | Goraf <22941576+Goraf@users.noreply.github.com> | 2017-12-05 22:17:19 +0100 |
commit | 7cf8ea2d9817e729af3a5596c34bee17a2bfe163 (patch) | |
tree | b3e69b4d2160141921631e74727a9ab69f91ec2e /tools | |
parent | a324843d011a6b58ab29b9965d6632b8729da809 (diff) |
lpgen.js: Strip comments from 'version' files (#990)
Diffstat (limited to 'tools')
-rw-r--r-- | tools/lpgen/lpgen.js | 5 |
1 files changed, 4 insertions, 1 deletions
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;
}
|