+ def handle_obraz(self, element):
+ name = element.attrib.get('nazwa', '').strip()
+ if not name:
+ print '!! <obraz> missing "nazwa"'
+ return
+ alt = element.attrib.get('alt', '')
+ if not alt:
+ print '** <obraz> missing "alt"'
+ slug, ext = name.rsplit('.', 1)
+ url = self.options['urlmapper'].url_for_image(slug, ext)
+ thumb_url = self.options['urlmapper'].url_for_image(slug, ext, IMAGE_THUMB_WIDTH)
+ e = etree.Element("a", attrib={"href": url, "class": "image"})
+ e.append(etree.Element("img", attrib={
+ "src": thumb_url,
+ "alt": alt,
+ "width": str(IMAGE_THUMB_WIDTH)}))
+ return etree.tostring(e, encoding=unicode), u""
+