Code

minor edit
[roundup.git] / roundup / template_parser.py
index ba6eb2c7bef00d173857a6eeed8104a7c461e39a..e3e8ec424c70575314e57e41699bb8743200fe8c 100644 (file)
@@ -34,7 +34,7 @@ class Property:
     '''
     def __init__(self, attributes):
         self.attributes = attributes
-        self.current = self.structure = []
+        self.current = self.ok = []
     def __len__(self):
         return len(self.current)
     def __getitem__(self, n):
@@ -70,12 +70,17 @@ class RoundupTemplate(htmllib.HTMLParser):
             self.current.append(data)
 
     def unknown_starttag(self, tag, attributes):
-        s = ''
-        s = s + '<%s' % tag
+        self.append_data('<%s' % tag)
+        closeit = 1
         for name, value in attributes:
-            s = s + ' %s="%s"' % (name, value)
-        s = s + '>'
-        self.append_data(s)
+            pos = value.find('<')
+            if pos > -1:
+                self.append_data(' %s="%s' % (name, value[:pos]))
+                closeit = 0
+            else:
+                self.append_data(' %s="%s"' % (name, value))
+        if closeit:
+            self.append_data('>')
 
     def handle_starttag(self, tag, method, attributes):
         if tag in ('require', 'else', 'display', 'property'):
@@ -134,7 +139,7 @@ def display(structure, indent=''):
             l.append('%sDISPLAY: %r'%(indent, entry.attributes))
         elif isinstance(entry, Property):
             l.append('%sPROPERTY: %r'%(indent, entry.attributes))
-            l.append(display(entry.structure, indent+' '))
+            l.append(display(entry.ok, indent+' '))
     return ''.join(l)
 
 if __name__ == '__main__':