Fix translation functionality to properly condense whitespace and parse escaped characters (#17)

This commit is contained in:
Frank Li 2017-07-16 20:34:26 -07:00 committed by Joel Marcey
parent 70ed75b046
commit 523d824651
3 changed files with 18 additions and 3 deletions

View file

@ -19,7 +19,7 @@ module.exports = function translatePlugin(babel) {
return;
}
/* assume translate element only has one child which is the text */
const text = path.node.children[0].value.trim();
const text = path.node.children[0].value.trim().replace(/\s+/g, " ");
let description = "no description given";
const attributes = path.node.openingElement.attributes;
for (let i = 0; i < attributes.length; i++) {