(self, tag, attrs)
| 50 | self.last_tag = tag |
| 51 | self.last = "endtag" |
| 52 | def handle_starttag(self, tag, attrs): |
| 53 | if tag == "pre": |
| 54 | self.in_pre = True |
| 55 | if self.is_block_tag(tag): |
| 56 | self.output = self.output.rstrip() |
| 57 | self.output += "<" + tag |
| 58 | # For now we don't strip out 'extra' attributes, because of |
| 59 | # raw HTML test cases. |
| 60 | # attrs = filter(lambda attr: attr[0] in significant_attrs, attrs) |
| 61 | if attrs: |
| 62 | attrs.sort() |
| 63 | for (k,v) in attrs: |
| 64 | self.output += " " + k |
| 65 | if v in ['href','src']: |
| 66 | self.output += ("=" + '"' + |
| 67 | urllib.quote(urllib.unquote(v), safe='/') + '"') |
| 68 | elif v != None: |
| 69 | self.output += ("=" + '"' + html.escape(v,quote=True) + '"') |
| 70 | self.output += ">" |
| 71 | self.last_tag = tag |
| 72 | self.last = "starttag" |
| 73 | def handle_startendtag(self, tag, attrs): |
| 74 | """Ignore closing tag for self-closing """ |
| 75 | self.handle_starttag(tag, attrs) |
no test coverage detected