aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2020-08-15 12:29:28 +0100
committerMichael Williamson <mike@zwobble.org>2020-08-15 12:29:28 +0100
commit8b6a4775f742d0a8b9b18581b0fd94c60b9a4e1d (patch)
tree5219d509dee5da78bcaf2ef4a294c47e69bbddc5
parent36713a54a9740dbad09cfb29e0382633d778ed73 (diff)
Read w:softHyphen
-rw-r--r--lib/docx/body-reader.js4
-rw-r--r--test/docx/body-reader.tests.js6
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/docx/body-reader.js b/lib/docx/body-reader.js
index 23c6a20..12a12c7 100644
--- a/lib/docx/body-reader.js
+++ b/lib/docx/body-reader.js
@@ -288,6 +288,10 @@ function BodyReader(options) {
return readXmlElements(element.firstOrEmpty("w:sdtContent").children);
},
+ "w:softHyphen": function(element) {
+ return elementResult(new documents.Text("\u00AD"));
+ },
+
"w:ins": readChildElements,
"w:object": readChildElements,
"w:smartTag": readChildElements,
diff --git a/test/docx/body-reader.tests.js b/test/docx/body-reader.tests.js
index 1260575..afdddfc 100644
--- a/test/docx/body-reader.tests.js
+++ b/test/docx/body-reader.tests.js
@@ -1219,6 +1219,12 @@ test("text nodes are ignored when reading children", function() {
assert.deepEqual(run, new documents.Run([]));
});
+test("soft hyphens are read as text", function() {
+ var runXml = new XmlElement("w:softHyphen", {}, []);
+ var text = readXmlElementValue(runXml);
+ assert.deepEqual(text, new documents.Text("\u00AD"));
+});
+
function paragraphWithStyleId(styleId) {
return new XmlElement("w:p", {}, [
new XmlElement("w:pPr", {}, [