- if 'material' in element.attrib:
- formats = re.split(r"[, ]+", element.attrib['format'])
+ if 'url' in element.attrib:
+ return tag('a', href=element.attrib['url'])(self, element)
+ elif 'material' in element.attrib:
+ formats = re.split(r"[, ]+",
+ element.attrib.get('format', DEFAULT_MATERIAL_FORMAT))
+ make_url = lambda f: self.options['urlmapper'] \
+ .url_for_material(element.attrib['material'], f)
+ def_href = make_url(formats[0])