Changeset 25:35f67e320b88
- Timestamp:
- 07/23/08 12:19:49 (5 years ago)
- Author:
- Nicolas Evrard <nicoe@…>
- Branch:
- default
- Message:
-
- Support the case where the image: expression contains a quote or guillemet
- Location:
- relatorio
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r24
|
r25
|
|
| 19 | 19 | ############################################################################### |
| 20 | 20 | |
| 21 | | __revision__ = "$Id: odt.py 25 2008-07-23 10:38:25Z nicoe $" |
| | 21 | __revision__ = "$Id: odt.py 26 2008-07-23 12:19:49Z nicoe $" |
| 22 | 22 | __metaclass__ = type |
| 23 | 23 | |
| … |
… |
|
| 177 | 177 | d_name = draw.attrib['{%s}name' % self.namespaces['draw']] |
| 178 | 178 | if d_name.startswith('image: '): |
| 179 | | attr_expr = "make_href(%s, '%s')" % (d_name[7:], d_name[7:]) |
| | 179 | attr_expr = "make_href(%s, %r)" % (d_name[7:], d_name[7:]) |
| 180 | 180 | attributes = {} |
| 181 | 181 | attributes['{%s}attrs' % self.namespaces['py']] = attr_expr |
-
|
r24
|
r25
|
|
| 20 | 20 | ############################################################################### |
| 21 | 21 | |
| 22 | | __revision__ = "$Id: test_odt.py 25 2008-07-23 10:38:25Z nicoe $" |
| | 22 | __revision__ = "$Id: test_odt.py 26 2008-07-23 12:19:49Z nicoe $" |
| 23 | 23 | |
| 24 | 24 | import os |
| … |
… |
|
| 65 | 65 | (file(os.path.join(thisdir, 'two.png')), |
| 66 | 66 | 'image/png')], |
| | 67 | 'oeuf': file(os.path.join(thisdir, 'egg.jpg')), |
| 67 | 68 | 'footer': u'We sell stuffs'} |
| 68 | 69 | |
| … |
… |
|
| 125 | 126 | root = tree.getroot() |
| 126 | 127 | images = root.xpath('//draw:frame', namespaces=self.oot.namespaces) |
| 127 | | eq_(len(images), 2) |
| | 128 | eq_(len(images), 3) |
| 128 | 129 | eq_(images[0].attrib['{%s}name' % self.oot.namespaces['draw']], |
| | 130 | "image: (oeuf, 'image/png')") |
| | 131 | eq_(images[1].attrib['{%s}name' % self.oot.namespaces['draw']], |
| 129 | 132 | 'image: img') |
| 130 | | eq_(images[0].attrib['{%s}width' % self.oot.namespaces['svg']], |
| 131 | | '1.732cm') |
| 132 | | eq_(images[0].attrib['{%s}height' % self.oot.namespaces['svg']], |
| 133 | | '1.513cm') |
| 134 | 133 | eq_(images[1].attrib['{%s}width' % self.oot.namespaces['svg']], |
| 135 | 134 | '1.732cm') |
| 136 | 135 | eq_(images[1].attrib['{%s}height' % self.oot.namespaces['svg']], |
| 137 | 136 | '1.513cm') |
| | 137 | eq_(images[2].attrib['{%s}width' % self.oot.namespaces['svg']], |
| | 138 | '1.732cm') |
| | 139 | eq_(images[2].attrib['{%s}height' % self.oot.namespaces['svg']], |
| | 140 | '1.513cm') |