gettext-parser
Advanced tools
Comparing version 7.0.0 to 7.0.1
@@ -268,45 +268,44 @@ const encoding = require('encoding'); | ||
tokens.forEach(node => { | ||
let comment; | ||
let lines; | ||
if (!node || node.type !== this.types.comments) { | ||
return; | ||
} | ||
if (node && node.type === this.types.comments) { | ||
comment = { | ||
translator: [], | ||
extracted: [], | ||
reference: [], | ||
flag: [], | ||
previous: [] | ||
}; | ||
const comment = { | ||
translator: [], | ||
extracted: [], | ||
reference: [], | ||
flag: [], | ||
previous: [] | ||
}; | ||
lines = (node.value || '').split(/\n/); | ||
const lines = (node.value || '').split(/\n/); | ||
lines.forEach(line => { | ||
switch (line.charAt(0) || '') { | ||
case ':': | ||
comment.reference.push(line.substr(1).trim()); | ||
break; | ||
case '.': | ||
comment.extracted.push(line.substr(1).replace(/^\s+/, '')); | ||
break; | ||
case ',': | ||
comment.flag.push(line.substr(1).replace(/^\s+/, '')); | ||
break; | ||
case '|': | ||
comment.previous.push(line.substr(1).replace(/^\s+/, '')); | ||
break; | ||
case '~': | ||
break; | ||
default: | ||
comment.translator.push(line.replace(/^\s+/, '')); | ||
} | ||
}); | ||
lines.forEach(line => { | ||
switch (line.charAt(0) || '') { | ||
case ':': | ||
comment.reference.push(line.substr(1).trim()); | ||
break; | ||
case '.': | ||
comment.extracted.push(line.substr(1).replace(/^\s+/, '')); | ||
break; | ||
case ',': | ||
comment.flag.push(line.substr(1).replace(/^\s+/, '')); | ||
break; | ||
case '|': | ||
comment.previous.push(line.substr(1).replace(/^\s+/, '')); | ||
break; | ||
case '~': | ||
break; | ||
default: | ||
comment.translator.push(line.replace(/^\s+/, '')); | ||
} | ||
}); | ||
node.value = {}; | ||
node.value = {}; | ||
Object.keys(comment).forEach(key => { | ||
if (comment[key] && comment[key].length) { | ||
node.value[key] = comment[key].join('\n'); | ||
} | ||
}); | ||
} | ||
Object.keys(comment).forEach(key => { | ||
if (comment[key] && comment[key].length) { | ||
node.value[key] = comment[key].join('\n'); | ||
} | ||
}); | ||
}); | ||
@@ -313,0 +312,0 @@ }; |
{ | ||
"name": "gettext-parser", | ||
"description": "Parse and compile gettext po and mo files to/from json, nothing more, nothing less", | ||
"version": "7.0.0", | ||
"version": "7.0.1", | ||
"author": "Andris Reinman", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
56702
1313