aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-09-02 22:06:01 +0100
committerMichael Williamson <mike@zwobble.org>2016-09-02 22:06:01 +0100
commitf6c25f725de0c4ee65e4a0d25aa1c08774b2b809 (patch)
tree2bdeb7d65616d5ab798d1f25079818def4f9eec8 /lib
parente5953b770484277e9119cef8358434cfad09df6b (diff)
Use alt text title if description is blank
Diffstat (limited to 'lib')
-rw-r--r--lib/docx/body-reader.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/docx/body-reader.js b/lib/docx/body-reader.js
index 7b3120d..519a50b 100644
--- a/lib/docx/body-reader.js
+++ b/lib/docx/body-reader.js
@@ -316,10 +316,15 @@ function BodyReader(options) {
}
function readBlip(element, blip) {
- var altText = element.first("wp:docPr").attributes.descr;
+ var properties = element.first("wp:docPr").attributes;
+ var altText = isBlank(properties.descr) ? properties.title : properties.descr;
return readImage(findBlipImageFile(blip), altText);
}
+ function isBlank(value) {
+ return /^\s*$/.test(value);
+ }
+
function findBlipImageFile(blip) {
var embedRelationshipId = blip.attributes["r:embed"];
var linkRelationshipid = blip.attributes["r:link"];