Pulled from upstream
This commit is contained in:
commit
2373525fef
|
@ -558,12 +558,15 @@ class ToolMixin(BaseMixin):
|
||||||
if setMin: day = 1
|
if setMin: day = 1
|
||||||
else: day = 31
|
else: day = 31
|
||||||
DateTime = self.getProductConfig().DateTime
|
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
|
# We loop until we find a valid date. For example, we could loop from
|
||||||
# 2009/02/31 to 2009/02/28.
|
# 2009/02/31 to 2009/02/28.
|
||||||
dateIsWrong = True
|
dateIsWrong = True
|
||||||
while dateIsWrong:
|
while dateIsWrong:
|
||||||
try:
|
try:
|
||||||
res = DateTime('%s/%s/%s' % (year, month, day))
|
res = DateTime('%s/%s/%s %s' % (year, month, day, hour))
|
||||||
dateIsWrong = False
|
dateIsWrong = False
|
||||||
except:
|
except:
|
||||||
day = int(day)-1
|
day = int(day)-1
|
||||||
|
|
|
@ -233,8 +233,8 @@ class Renderer:
|
||||||
stylesMapping = self.stylesManager.checkStylesMapping(stylesMapping)
|
stylesMapping = self.stylesManager.checkStylesMapping(stylesMapping)
|
||||||
ns = self.currentParser.env.namespaces
|
ns = self.currentParser.env.namespaces
|
||||||
# xhtmlString is only a chunk of XHTML. So we must surround it a tag in
|
# 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)
|
# order to get a XML-compliant file (we need a root tag).
|
||||||
xhtmlContent = '<podXhtml>%s</podXhtml>' % xhtmlString
|
xhtmlContent = '<p>%s</p>' % xhtmlString
|
||||||
return Xhtml2OdtConverter(xhtmlContent, encoding, self.stylesManager,
|
return Xhtml2OdtConverter(xhtmlContent, encoding, self.stylesManager,
|
||||||
stylesMapping, ns).run()
|
stylesMapping, ns).run()
|
||||||
|
|
||||||
|
|
|
@ -151,9 +151,9 @@ class StylesParser(OdfParser):
|
||||||
# Record this style in the environment
|
# Record this style in the environment
|
||||||
e.styles[style.name] = style
|
e.styles[style.name] = style
|
||||||
e.currentStyle = style
|
e.currentStyle = style
|
||||||
outlineLevelKey = '%s:default-outline-level' % e.ns(e.NS_STYLE)
|
levelKey = '%s:default-outline-level' % e.ns(e.NS_STYLE)
|
||||||
if attrs.has_key(outlineLevelKey):
|
if attrs.has_key(levelKey) and attrs[levelKey].strip():
|
||||||
style.outlineLevel = int(attrs[outlineLevelKey])
|
style.outlineLevel = int(attrs[levelKey])
|
||||||
else:
|
else:
|
||||||
if e.state == PARSING_STYLE:
|
if e.state == PARSING_STYLE:
|
||||||
# I am parsing tags within the style.
|
# I am parsing tags within the style.
|
||||||
|
|
3395
pod/test/Tests.rtf
3395
pod/test/Tests.rtf
File diff suppressed because it is too large
Load diff
Binary file not shown.
Binary file not shown.
|
@ -18,7 +18,7 @@ from appy.pod import *
|
||||||
HTML_2_ODT = {'h1':'h', 'h2':'h', 'h3':'h', 'h4':'h', 'h5':'h', 'h6':'h',
|
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',
|
'p':'p', 'b':'span', 'i':'span', 'strong':'span', 'strike':'span',
|
||||||
'u':'span', 'em': 'span', 'sub': 'span', 'sup': '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',
|
DEFAULT_ODT_STYLES = {'b': 'podBold', 'strong':'podBold', 'i': 'podItalic',
|
||||||
'u': 'podUnderline', 'strike': 'podStrike',
|
'u': 'podUnderline', 'strike': 'podStrike',
|
||||||
'em': 'podItalic', 'sup': 'podSup', 'sub':'podSub',
|
'em': 'podItalic', 'sup': 'podSup', 'sub':'podSub',
|
||||||
|
@ -37,8 +37,7 @@ class HtmlElement:
|
||||||
'''Every time an HTML element is encountered during the SAX parsing,
|
'''Every time an HTML element is encountered during the SAX parsing,
|
||||||
an instance of this class is pushed on the stack of currently parsed
|
an instance of this class is pushed on the stack of currently parsed
|
||||||
elements.'''
|
elements.'''
|
||||||
elemTypes = {'p':'para', 'li':'para','ol':'list','ul':'list',
|
elemTypes = {'p':'para', 'li':'para','ol':'list','ul':'list'}
|
||||||
'podxhtml': 'para'}
|
|
||||||
def __init__(self, elem, attrs):
|
def __init__(self, elem, attrs):
|
||||||
self.elem = elem
|
self.elem = elem
|
||||||
# Keep "class" attribute (useful for finding the corresponding ODT
|
# Keep "class" attribute (useful for finding the corresponding ODT
|
||||||
|
|
Loading…
Reference in a new issue