changeset 655:e420833c5f08

Added tag ignoring in order to allow HTML/BODY tags in the html blob.
author Alexander Schremmer <alex AT alexanderweb DOT de>
date Tue, 16 May 2006 14:55:16 +0200
parents 54b8e7d068d9
children e9eff264e2b9 0c9cd543daac
files .hgignore MoinMoin/support/htmlmarkup.py
diffstat 2 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Tue May 16 09:25:59 2006 +0200
+++ b/.hgignore	Tue May 16 14:55:16 2006 +0200
@@ -1,4 +1,5 @@
 \{arch\}
 .*\.arch-ids/.*
 .*\.py[co]
+sa
 
--- a/MoinMoin/support/htmlmarkup.py	Tue May 16 09:25:59 2006 +0200
+++ b/MoinMoin/support/htmlmarkup.py	Tue May 16 14:55:16 2006 +0200
@@ -204,6 +204,8 @@
         'span', 'src', 'start', 'style', 'summary', 'tabindex',
         'target', 'title', 'type', 'usemap', 'valign', 'value',
         'vspace', 'width'])
+    ignore_tags = frozenset(['html', 'body'])
+    
     uri_attrs = frozenset(['action', 'background', 'dynsrc', 'href',
                            'lowsrc', 'src'])
     safe_schemes = frozenset(['file', 'ftp', 'http', 'https', 'mailto',
@@ -217,6 +219,9 @@
     def handle_starttag(self, tag, attrs):
         if self.waiting_for:
             return
+        if tag in self.ignore_tags:
+            return
+        
         if tag not in self.safe_tags:
             self.waiting_for = tag
             return
@@ -268,6 +273,9 @@
             self.out.write(escape(data, quotes=False))
 
     def handle_endtag(self, tag):
+        if tag in self.ignore_tags:
+            return
+
         if self.waiting_for:
             if self.waiting_for == tag:
                 self.waiting_for = None