Comparing version 4.1.2 to 4.1.3
{ | ||
"name": "xliff", | ||
"version": "4.1.2", | ||
"version": "4.1.3", | ||
"description": "xliff2js and js2xliff converter xliff utils", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -23,2 +23,14 @@ const expect = require('expect.js'); | ||
it('removes a trailing line break and space from a "formatted" XML text element', () => { | ||
expect(extractValue({ type: 'text', text: 'Hello \n ' }, ElementTypes12)).to.eql('Hello '); | ||
}); | ||
it('removes trailing line breaks from a "formatted" XML text element with an embedded line break', () => { | ||
expect(extractValue({ type: 'text', text: 'Hello \n There\n ' }, ElementTypes12)).to.eql('Hello \n There'); | ||
}); | ||
it('does not throw away content from a "formatted" XML text element with no trailing line break', () => { | ||
expect(extractValue({ type: 'text', text: 'Hello \n There' }, ElementTypes12)).to.eql('Hello \n There'); | ||
}); | ||
it('creates objects for all supported inline element types', () => { | ||
@@ -25,0 +37,0 @@ const supportedElementTypes = Object.keys(ElementTypes); |
@@ -22,3 +22,3 @@ const convert = require('xml-js'); | ||
const xliffRoot = xmlObj.elements[0]; | ||
const xliffRoot = xmlObj.elements.find((ele) => ele.name === 'xliff'); | ||
@@ -37,2 +37,4 @@ if (xliffRoot.attributes) { | ||
resources[namespace] = file.elements.reduce((file, unit) => { | ||
if (unit.name !== 'unit') return file; | ||
const key = unit.attributes.id; | ||
@@ -39,0 +41,0 @@ |
@@ -16,3 +16,6 @@ const tagToElementType = require('../inline-elements/typeToTagMaps').tagToElementType; | ||
if (valueElement.type === 'text') { | ||
return valueElement.text.indexOf('\n') === -1 ? valueElement.text : valueElement.text.substr(0, valueElement.text.lastIndexOf('\n')); | ||
if (/\n\s*$/.test(valueElement.text)) { | ||
return valueElement.text.substr(0, valueElement.text.lastIndexOf('\n')); | ||
} | ||
return valueElement.text; | ||
} | ||
@@ -19,0 +22,0 @@ |
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
91734
1424