diff --git a/gen/ui/page.pt b/gen/ui/page.pt index 13ddb39..07f020d 100644 --- a/gen/ui/page.pt +++ b/gen/ui/page.pt @@ -189,7 +189,8 @@ Title - +
diff --git a/pod/parts.py b/pod/parts.py index 085b56e..505fc35 100644 --- a/pod/parts.py +++ b/pod/parts.py @@ -31,11 +31,11 @@ class OdtTable: self.html = html def dumpCell(self, content, span=1, header=False, - paraStyle=None, cellStyle=None): + paraStyle=None, cellStyle=None, align=None): '''Dumps a cell in the table. If no specific p_paraStyle (p_cellStyle) is given, self.paraStyle (self.cellStyle) is used, excepted if p_header is True: in that case, self.paraHeaderStyle - (self.cellHeaderStyle) is used.''' + (self.cellHeaderStyle) is used. p_align is used only for HTML.''' if not paraStyle: if header: paraStyle = self.paraHeaderStyle else: paraStyle = self.paraStyle @@ -52,8 +52,10 @@ class OdtTable: self.res += '' % self.tns else: tag = header and 'th' or 'td' - self.res += '<%s colspan="%d">%s' % \ - (tag, span, cgi.escape(str(content)), tag) + palign = '' + if align: palign = ' align="%s"' % align + self.res += '<%s colspan="%d"%s>%s' % \ + (tag, span, palign, cgi.escape(str(content)), tag) def startRow(self): if not self.html: diff --git a/shared/__init__.py b/shared/__init__.py index 8997905..ec9cd29 100644 --- a/shared/__init__.py +++ b/shared/__init__.py @@ -16,6 +16,7 @@ mimeTypesExts = { 'application/pdf' : 'pdf', 'image/png' : 'png', 'image/jpeg' : 'jpg', + 'image/pjpeg' : 'jpg', 'image/gif' : 'gif' } xmlPrologue = '\n' diff --git a/shared/diff.py b/shared/diff.py index e5be6b5..8a9c4b7 100644 --- a/shared/diff.py +++ b/shared/diff.py @@ -245,19 +245,27 @@ class HtmlDiff: deleteStyle = 'color: red; text-decoration: line-through; cursor: help' def __init__(self, old, new, - insertMsg='Inserted text', deleteMsg='Deleted text', + insertMsg=u'Inserted text', deleteMsg=u'Deleted text', insertCss=None, deleteCss=None, insertName='insert', deleteName='delete', diffRatio=0.7): - # p_old and p_new are strings containing chunks of HTML. + # p_old and p_new are strings containing chunks of HTML. If they are not + # unicode strings, we convert them to unicode; this way, every char is + # only one char lenght. self.old = old.strip() + if isinstance(self.old, str): self.old = self.old.decode('utf-8') self.new = new.strip() + if isinstance(self.new, str): self.new = self.new.decode('utf-8') # Every time an "insert" or "delete" difference will be detected from # p_old to p_new, the impacted chunk will be surrounded by a tag that # will get, respectively, a 'title' attribute filled p_insertMsg or # p_deleteMsg. The message will give an explanation about the change # (who made it and at what time, for example). self.insertMsg = insertMsg + if isinstance(self.insertMsg, str): + self.insertMsg = self.insertMsg.decode('utf-8') self.deleteMsg = deleteMsg + if isinstance(self.deleteMsg, str): + self.deleteMsg = self.deleteMsg.decode('utf-8') # This tag will get a CSS class p_insertCss or p_deleteCss for # highlighting the change. If no class is provided, default styles will # be used (see HtmlDiff.insertStyle and HtmlDiff.deleteStyle).