def get_attribute_exceptions(self, key, value): u""" The <code>get_attribute_exceptions</code> method writes the attribute, and checks on naming differences between the Xierpa attributes and HTML attributes. """ # Boolean attributes. key = TX.dataAttribute2Html5Attribute(key) if key in self.BOOLEAN_ATTRIBUTES: if TX.value2Bool(value): # Can be boolean or text boolean self.write_attribute(key, self.BOOLEAN_ATTRIBUTES[key]) else: # Some exceptions. if key.startswith('html'): key = key[3:] if key == 'class_': key = 'class' # elif key == 'src': # value = self.e.getPath(value) elif key == 'rowspan': if int(value) <= 1: return elif key == 'colspan': if int(value) <= 1: return elif key == 'xmllang': key = 'xml:lang' elif key == 'httpequiv': key = 'http-equiv' elif key == 'usemap': if not value.startswith(u'#'): value = u'#' + value # Handle Angular.org attributes that contain underscores, translate them to hyphens elif key.startswith('ng_'): key = key.replace('_', '-') self.write_attribute(key, value)