ODT Input: Fix handling of the <text:s> element. Fixes #749655 (Private bug)

This commit is contained in:
Kovid Goyal 2011-04-03 14:31:14 -06:00
parent 1d84c0d6ac
commit 492d16e5c9

View File

@ -1386,12 +1386,19 @@ ol, ul { padding-left: 2em; }
self.purgedata() self.purgedata()
def s_text_s(self, tag, attrs): def s_text_s(self, tag, attrs):
""" Generate a number of spaces. ODF has an element; HTML uses &nbsp; # Changed by Kovid to fix non breaking spaces being prepended to
We use &#160; so we can send the output through an XML parser if we desire to # element instead of being part of the text flow.
# We don't use an entity for the nbsp as the contents of self.data will
# be escaped on writeout.
""" Generate a number of spaces. We use the non breaking space for
the text:s ODF element.
""" """
c = attrs.get( (TEXTNS,'c'),"1") try:
for x in xrange(int(c)): c = int(attrs.get((TEXTNS, 'c'), 1))
self.writeout('&#160;') except:
c = 0
if c > 0:
self.data.append(u'\u00a0'*c)
def s_text_span(self, tag, attrs): def s_text_span(self, tag, attrs):
""" The <text:span> element matches the <span> element in HTML. It is """ The <text:span> element matches the <span> element in HTML. It is