Pulled from upstream

This commit is contained in:
Thomas 'nezza-_-' Roth 2011-02-15 14:40:52 +01:00
commit 2373525fef
7 changed files with 1711 additions and 1704 deletions

View file

@ -558,12 +558,15 @@ class ToolMixin(BaseMixin):
if setMin: day = 1
else: day = 31
DateTime = self.getProductConfig().DateTime
# Set the hour
if setMin: hour = '00:00'
else: hour = '23:59'
# We loop until we find a valid date. For example, we could loop from
# 2009/02/31 to 2009/02/28.
dateIsWrong = True
while dateIsWrong:
try:
res = DateTime('%s/%s/%s' % (year, month, day))
res = DateTime('%s/%s/%s %s' % (year, month, day, hour))
dateIsWrong = False
except:
day = int(day)-1

View file

@ -233,8 +233,8 @@ class Renderer:
stylesMapping = self.stylesManager.checkStylesMapping(stylesMapping)
ns = self.currentParser.env.namespaces
# xhtmlString is only a chunk of XHTML. So we must surround it a tag in
# order to get a XML-compliant file (we need a root tag)
xhtmlContent = '<podXhtml>%s</podXhtml>' % xhtmlString
# order to get a XML-compliant file (we need a root tag).
xhtmlContent = '<p>%s</p>' % xhtmlString
return Xhtml2OdtConverter(xhtmlContent, encoding, self.stylesManager,
stylesMapping, ns).run()

View file

@ -151,9 +151,9 @@ class StylesParser(OdfParser):
# Record this style in the environment
e.styles[style.name] = style
e.currentStyle = style
outlineLevelKey = '%s:default-outline-level' % e.ns(e.NS_STYLE)
if attrs.has_key(outlineLevelKey):
style.outlineLevel = int(attrs[outlineLevelKey])
levelKey = '%s:default-outline-level' % e.ns(e.NS_STYLE)
if attrs.has_key(levelKey) and attrs[levelKey].strip():
style.outlineLevel = int(attrs[levelKey])
else:
if e.state == PARSING_STYLE:
# I am parsing tags within the style.

File diff suppressed because it is too large Load diff

Binary file not shown.

Binary file not shown.

View file

@ -18,7 +18,7 @@ from appy.pod import *
HTML_2_ODT = {'h1':'h', 'h2':'h', 'h3':'h', 'h4':'h', 'h5':'h', 'h6':'h',
'p':'p', 'b':'span', 'i':'span', 'strong':'span', 'strike':'span',
'u':'span', 'em': 'span', 'sub': 'span', 'sup': 'span',
'br': 'line-break', 'div': 'span', 'podxhtml':'p'}
'br': 'line-break', 'div': 'span'}
DEFAULT_ODT_STYLES = {'b': 'podBold', 'strong':'podBold', 'i': 'podItalic',
'u': 'podUnderline', 'strike': 'podStrike',
'em': 'podItalic', 'sup': 'podSup', 'sub':'podSub',
@ -37,8 +37,7 @@ class HtmlElement:
'''Every time an HTML element is encountered during the SAX parsing,
an instance of this class is pushed on the stack of currently parsed
elements.'''
elemTypes = {'p':'para', 'li':'para','ol':'list','ul':'list',
'podxhtml': 'para'}
elemTypes = {'p':'para', 'li':'para','ol':'list','ul':'list'}
def __init__(self, elem, attrs):
self.elem = elem
# Keep "class" attribute (useful for finding the corresponding ODT