diff --git a/src/libprs500/ebooks/lrf/objects.py b/src/libprs500/ebooks/lrf/objects.py
index 9c931fef59..a7d28e99ac 100644
--- a/src/libprs500/ebooks/lrf/objects.py
+++ b/src/libprs500/ebooks/lrf/objects.py
@@ -289,6 +289,7 @@ class RuledLine(EmptyPageElement):
self.linelength, self.linewidth = linelength, linewidth
self.linetype = self.linetype_map[linetype]
self.linecolor = Color(linecolor)
+ self.id = -1
def __unicode__(self):
return u'\n\n'%\
@@ -498,6 +499,7 @@ class Block(LRFStream):
self.name = 'ImageBlock'
for attr in ('x0', 'x1', 'y0', 'y1', 'xsize', 'ysize', 'refstream'):
self.attrs[attr] = getattr(obj, attr)
+ self.refstream = self._document.objects[self.attrs['refstream']]
elif isinstance(obj, Button):
self.name = 'ButtonBlock'
else:
@@ -588,7 +590,7 @@ class Text(LRFStream):
0xF5D2: 'cr',
}
- text_map = { 0x22: u'"', 0x26: u'&', 0x27: u''', 0x3c: u'<', 0x3e: u'>' }
+ text_map = { 0x22: u'"', 0x26: u'&', 0x27: u'&squot;', 0x3c: u'<', 0x3e: u'>' }
linetype_map = {0: 'none', 0x10: 'solid', 0x20: 'dashed', 0x30: 'double', 0x40: 'dotted'}
adjustment_map = {1: 'top', 2: 'center', 3: 'baseline', 4: 'bottom'}
lineposition_map = {1:'before', 2:'after'}
@@ -625,7 +627,8 @@ class Text(LRFStream):
if h[0] not in self.attrs:
self.attrs[h[0]] = val
elif val != self.attrs[h[0]]:
- if self._contents: self.parent._contents.append(self)
+ if self._contents:
+ self.parent._contents.append(self)
Text.Content(self.stream, self.objects, self.parent,
'Span', {h[0]: val})
@@ -644,7 +647,7 @@ class Text(LRFStream):
def end_container(self, *args):
self.in_container = False
- if self.name == 'Span' and self._contents:
+ if self.name == 'Span' and self._contents and self not in self.parent._contents:
self.parent._contents.append(self)
def end_to_root(self):
@@ -724,9 +727,11 @@ class Text(LRFStream):
def plot(self, tag):
xsize, ysize, refobj, adjustment = struct.unpack("'
s = u''
if self.name is not None:
s += u'<'+self.name+u' '
for attr in self.attrs:
s += u'%s="%s" '%(attr, self.attrs[attr])
- s = s.rstrip() + u'>'
+ s = s.rstrip()
+ children = u''
for i in self:
- s += unicode(i)
- if self.name is not None:
- s += u'%s>'%(self.name,)
- if self.name in ['P', "CR"]:
- s += '\n'
- return s
+ children += unicode(i)
+ if len(children) == 0:
+ return s + u' />'
+ if self.name is None:
+ return children
+ return s + u'>' + children + '%s>'%(self.name,) + ('\n' if self.name == 'P' else '')
def __str__(self):
- return unicode(self)
+ return unicode(self).encode('utf-8')
def initialize(self):
self.content = Text.Content(self.stream, self._document.objects)
@@ -963,7 +968,7 @@ class Button(LRFObject):
return s
refpage = property(fget=lambda self : self.jump_action(2)[0])
- refobject = property(fget=lambda self : self.jump_action(2)[1])
+ refobj = property(fget=lambda self : self.jump_action(2)[1])
class Window(LRFObject):