moddle-xml
Advanced tools
Comparing version 11.0.0-exp.3 to 11.0.0-exp.4
@@ -220,2 +220,10 @@ import { forEach, assign, find, isString, findIndex, filter, has } from 'min-dash'; | ||
const property = this.property; | ||
const idAttr = property.xml && property.xml.idAttr; | ||
if (idAttr && node.attributes[idAttr]) { | ||
this.element.id = node.attributes[idAttr]; | ||
} | ||
return this; | ||
@@ -225,3 +233,3 @@ }; | ||
ReferenceHandler.prototype.handleEnd = function() { | ||
this.element.id = this.body; | ||
this.element.id = this.element.id || this.body; | ||
}; | ||
@@ -1198,4 +1206,6 @@ | ||
ReferenceSerializer.prototype.build = function(element) { | ||
ReferenceSerializer.prototype.build = function(property, element) { | ||
this.property = property; | ||
this.element = element; | ||
return this; | ||
@@ -1205,6 +1215,19 @@ }; | ||
ReferenceSerializer.prototype.serializeTo = function(writer) { | ||
writer | ||
.appendIndent() | ||
.append('<' + this.tagName + '>' + this.element.id + '</' + this.tagName + '>') | ||
.appendNewLine(); | ||
const property = this.property; | ||
const idAttr = property.xml && property.xml.idAttr; | ||
const id = this.element.id; | ||
const tagName = this.tagName; | ||
writer.appendIndent(); | ||
if (idAttr) { | ||
writer.append('<' + tagName + ' ' + idAttr + '="' + id + '" />'); | ||
} else { | ||
writer.append('<' + tagName + '>' + id + '</' + tagName + '>'); | ||
} | ||
writer.appendNewLine(); | ||
}; | ||
@@ -1487,3 +1510,3 @@ | ||
forEach(value, function(v) { | ||
body.push(new ReferenceSerializer(self.addTagName(self.nsPropertyTagName(p))).build(v)); | ||
body.push(new ReferenceSerializer(self.addTagName(self.nsPropertyTagName(p))).build(p, v)); | ||
}); | ||
@@ -1490,0 +1513,0 @@ } else { |
{ | ||
"name": "moddle-xml", | ||
"version": "11.0.0-exp.3", | ||
"version": "11.0.0-exp.4", | ||
"description": "XML import/export for documents described with moddle", | ||
@@ -50,12 +50,12 @@ "scripts": { | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "^22.0.2", | ||
"@rollup/plugin-node-resolve": "^14.1.0", | ||
"@rollup/plugin-terser": "^0.2.1", | ||
"@rollup/plugin-commonjs": "^24.0.1", | ||
"@rollup/plugin-node-resolve": "^15.0.1", | ||
"@rollup/plugin-terser": "^0.4.0", | ||
"chai": "^4.3.6", | ||
"eslint": "^8.24.0", | ||
"eslint-plugin-bpmn-io": "^0.16.0", | ||
"eslint": "^8.34.0", | ||
"eslint-plugin-bpmn-io": "^1.0.0", | ||
"mocha": "^10.0.0", | ||
"moddle": "^7.0.0-exp.2", | ||
"moddle": "^7.0.0-exp.3", | ||
"npm-run-all": "^4.1.5", | ||
"rollup": "^2.79.1" | ||
"rollup": "^3.17.2" | ||
}, | ||
@@ -62,0 +62,0 @@ "dependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
380138
6080