changeset 3988:be43e3973baa

fix gui editor remove inline comments problem
author Byeongweon [tasyblue@gmail.com]
date Wed, 30 Jul 2008 19:54:07 +0900
parents 561cd7560781
children dd7446b5e95c
files MoinMoin/converter/text_html_text_moin_wiki.py MoinMoin/formatter/text_gedit.py
diffstat 2 files changed, 19 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/converter/text_html_text_moin_wiki.py	Tue Jul 29 02:44:33 2008 +0900
+++ b/MoinMoin/converter/text_html_text_moin_wiki.py	Wed Jul 30 19:54:07 2008 +0900
@@ -825,8 +825,11 @@
         is_strong = "bold" in node_style
         is_italic = "italic" in node_style
         is_underline = "underline" in node_style
-        
-        
+        is_comment = node.getAttribute("class") == "comment"
+
+        # start tag        
+        if is_comment:
+            self.text.append("/* ")
         if is_strike:
             self.text.append("--(")
         if is_strong:
@@ -834,9 +837,13 @@
         if is_italic:
             self.text.append("''")
         if is_underline:
-            self.text.append("__")
+            self.text.append("__")
+
+        # body        
         for i in node.childNodes:
             self.process_inline(i)
+
+        # end tag
         if is_underline:
             self.text.append("__")
         if is_italic:
@@ -844,7 +851,9 @@
         if is_strong:
             self.text.append("'''")
         if is_strike:
-            self.text.append(")--")
+            self.text.append(")--")
+        if is_comment:
+            self.text.append(" */")
 
     def process_div(self, node):
         # ignore div tags - just descend
--- a/MoinMoin/formatter/text_gedit.py	Tue Jul 29 02:44:33 2008 +0900
+++ b/MoinMoin/formatter/text_gedit.py	Wed Jul 30 19:54:07 2008 +0900
@@ -234,3 +234,9 @@
     def line_anchorlink(self, on, lineno=0):
         return '' # not needed for gui editor feeding
 
+    def span(self, on, **kw):
+        previous_state = self.request.user.show_comments
+        self.request.user.show_comments = True
+        ret = text_html.Formatter.span(self, on, **kw)
+        self.request.user.show_comments = previous_state
+        return ret