Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions InteractiveHtmlBom/web/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function saveBomTable(output) {
for (var node of bomhead.childNodes[0].childNodes) {
if (node.firstChild) {
var name = node.firstChild.nodeValue ?? "";
text += (output == 'csv' ? `"${name}"` : name);
text += (output == 'csv' ? `"${name.replace(/\"/g, '\"\"')}"` : name);
}
if (node != bomhead.childNodes[0].lastChild) {
text += (output == 'csv' ? ',' : '\t');
Expand All @@ -86,16 +86,15 @@ function saveBomTable(output) {
if (node.checked) {
val += '✓';
}
} else if ((node.nodeName == "MARK") || (node.nodeName == "A")) {
val += node.firstChild.nodeValue;
} else {
val += node.nodeValue;
// Text, highlight marks and links (which may contain marks)
val += node.textContent;
}
}
if (output == 'csv') {
val = val.replace(/\"/g, '\"\"'); // pair of double-quote characters
if (isNumeric(val)) {
val = +val; // use number
if (isNumeric(val) && String(+val) === val) {
val = +val; // use number if it is lossless
} else {
val = `"${val}"`; // enclosed within double-quote
}
Expand Down