From 5a484ab1f55d36977e8ed15aefef3daff36d1fb2 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Tue, 8 Jul 2014 11:03:27 +0100 Subject: Extract common image conversion code --- mammoth/images.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 mammoth/images.py (limited to 'mammoth/images.py') 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 -- cgit v1.2.3