aboutsummaryrefslogtreecommitdiff
path: root/mammoth
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2015-02-08 20:40:36 +0000
committerMichael Williamson <mike@zwobble.org>2015-02-08 20:40:36 +0000
commit8226b3196647b56a4af7567bdccb63141958aa3b (patch)
tree8190dd933bce768ff8bbb0ddb8d6696829acbe58 /mammoth
parenta098466259ce25c82f5c5faa5b2dcd3b9c8f90d6 (diff)
Ignore img tags without alt nor src in markdown writer
Diffstat (limited to 'mammoth')
-rw-r--r--mammoth/writers/markdown.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/mammoth/writers/markdown.py b/mammoth/writers/markdown.py
index 5e3cf00..0183423 100644
--- a/mammoth/writers/markdown.py
+++ b/mammoth/writers/markdown.py
@@ -37,7 +37,10 @@ def _hyperlink(attributes):
def _image(attributes):
src = attributes.get("src", "")
alt_text = attributes.get("alt", "")
- return _WriterOutput("![{0}]({1})".format(alt_text, src), "")
+ if src or alt_text:
+ return _WriterOutput("![{0}]({1})".format(alt_text, src), "")
+ else:
+ return _default_output
def _init_writers():