def get_xml(self): """ Get the XML representation as `ElementTree` object. :return: XML `ElementTree` of this object and all its subelements """ self.attribs['d'] = to_unicode(strlist(self.commands, ' ')) return super(Path, self).get_xml()
def value_to_string(self, value): """ Converts *value* into a <string> includes a value check, depending on :attr:`self.debug` and :attr:`self.profile`. """ if isinstance(value, (int, float)): if self.debug: self.validator.check_svg_type(value, 'number') if isinstance(value, float) and self.profile == 'tiny': value = round(value, 4) return to_unicode(value)
def get_xml(self): xml = super(TSpan, self).get_xml() xml.text = to_unicode(self.text) return xml
def get_xml(self): self.update_id() # if href is an object - 'id' - attribute may be changed! xml = super(TextPath, self).get_xml() xml.text = to_unicode(self.text) return xml
def __init__(self, text): self.xml = etree.Element(self.elementname) self.xml.text = to_unicode(text)
def test_non_us_ascii_chars(self): txt = TSpan('öäü') self.assertEqual(txt.tostring(), to_unicode('<tspan>öäü</tspan>'))
def test_float_to_unicode(self): self.assertEqual(u'10.1', to_unicode(10.1))
def test_int_to_unicode(self): self.assertEqual(u'10', to_unicode(10))
def test_unicode_to_unicode(self): self.assertEqual(u'süß', to_unicode(u'süß'))