diff options
| author | Michael Williamson <mike@zwobble.org> | 2014-07-08 11:03:27 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2014-07-08 11:03:27 +0100 |
| commit | 5a484ab1f55d36977e8ed15aefef3daff36d1fb2 (patch) | |
| tree | 0d2f810af7b42303dda1764efa89882100bb0a7c /mammoth/images.py | |
| parent | 0e046e91f26c8c222dc9b6a683514fe5a5895675 (diff) | |
Extract common image conversion code
Diffstat (limited to 'mammoth/images.py')
| -rw-r--r-- | mammoth/images.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/mammoth/images.py b/mammoth/images.py new file mode 100644 index 0000000..713f739 --- /dev/null +++ b/mammoth/images.py @@ -0,0 +1,9 @@ +def inline(func): + def convert_image(image, html_generator): + attributes = func(image).copy() + if image.alt_text: + attributes["alt"] = image.alt_text + + html_generator.self_closing("img", attributes) + + return convert_image |
