Commits

Juha Komulainen committed 3a25bc0

Fixed comment stripping.

Comments (0)

Files changed (1)

         self.props = props
         
     def strip_comments(self):
-        for prop in self.props:
-            if prop.ident == 'C':
-                self.props.remove(prop)
+        self.props = [p for p in self.props if p.ident != 'C']
         
     def to_sgf(self):
         return "\n;" + "".join(p.to_sgf() for p in self.props)
         self.value = value
         
     def to_sgf(self):
-        return "[%s]" % str(self.value) # todo
+        sb = []
+        for c in str(self.value):
+            if c in '\\]':
+                sb.append('\\')
+            sb.append(c)
+
+        return '[' + ''.join(sb) + ']'
 
 # utils