changeset 277:08778f685aaf

begin fixing http://moinmoin.wikiwikiweb.de/MoinMoinBugs/GuiEditorDestroysTableStyles (incomplete) imported from: moin--main--1.5--patch-281
author Thomas Waldmann <tw@waldmann-edv.de>
date Sat, 03 Dec 2005 15:04:31 +0000
parents 9b21b7907167
children ce748c8271dd
files MoinMoin/converter/text_html_text_x_moin.py MoinMoin/formatter/text_gedit.py
diffstat 2 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/converter/text_html_text_x_moin.py	Sat Dec 03 11:47:16 2005 +0000
+++ b/MoinMoin/converter/text_html_text_x_moin.py	Sat Dec 03 15:04:31 2005 +0000
@@ -825,9 +825,12 @@
         if node.hasAttribute("height"):
             value = node.getAttribute("height")
             result.append('tableheight="%s"' % self._check_length(value))
+        if node.hasAttribute("align"):
+            value = node.getAttribute("align")
+            result.append('tablealign="%s"' % value)
         if node.hasAttribute("style"):
             result.append('tablestyle="%s"' % node.getAttribute("style"))
-        return "".join(result)
+        return " ".join(result)
 
     def _row_style(self, node):
         result = []
--- a/MoinMoin/formatter/text_gedit.py	Sat Dec 03 11:47:16 2005 +0000
+++ b/MoinMoin/formatter/text_gedit.py	Sat Dec 03 15:04:31 2005 +0000
@@ -164,9 +164,12 @@
     style2attribute = {
         'width': 'width',
         'height': 'height',
+        'background' : 'bgcolor',
         'background-color' : 'bgcolor',
-        'text-align' : 'align',
-        'vertical-align' : 'valign'
+        #if this is used as table style="text-align: right", it doesn't work
+        #if it is transformed to align="right":
+        #'text-align' : 'align',
+        #'vertical-align' : 'valign'
         }
 
     def _style_to_attributes(self, attrs):
@@ -183,8 +186,8 @@
             if self.style2attribute.has_key(key):
                 attrs[self.style2attribute[key]] = value
             else:
-                unknown.append("%s:%s" %(key, value))
-        if len(unknown)>1:
+                unknown.append("%s:%s" % (key, value))
+        if unknown:
             attrs['style'] = ';'.join(unknown)
         else:
             del attrs['style']
@@ -208,7 +211,9 @@
             if not attrs:
                 attrs = {}
             else:
+                #result.append(self.rawHTML("<!-- ATTRS1: %s -->" % repr(attrs)))
                 attrs = self._checkTableAttr(attrs, 'table')
+                #result.append(self.rawHTML("<!-- ATTRS2: %s -->" % repr(attrs)))
             result.append(self.open('table', newline=1, attr=attrs))
         else:
             # Close table then div