| OLD | NEW |
| 1 # Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 1 # Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions | 4 # modification, are permitted provided that the following conditions |
| 5 # are met: | 5 # are met: |
| 6 # | 6 # |
| 7 # 1. Redistributions of source code must retain the above | 7 # 1. Redistributions of source code must retain the above |
| 8 # copyright notice, this list of conditions and the following | 8 # copyright notice, this list of conditions and the following |
| 9 # disclaimer. | 9 # disclaimer. |
| 10 # 2. Redistributions in binary form must reproduce the above | 10 # 2. Redistributions in binary form must reproduce the above |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 def convert_attributes_if_needed(self, tag, attrs): | 161 def convert_attributes_if_needed(self, tag, attrs): |
| 162 """Converts attributes in a start tag in HTML. | 162 """Converts attributes in a start tag in HTML. |
| 163 | 163 |
| 164 The converted tag text is appended to |self.converted_data|. | 164 The converted tag text is appended to |self.converted_data|. |
| 165 """ | 165 """ |
| 166 converted = self.get_starttag_text() | 166 converted = self.get_starttag_text() |
| 167 for attr_name, attr_value in attrs: | 167 for attr_name, attr_value in attrs: |
| 168 if attr_name == 'style': | 168 if attr_name == 'style': |
| 169 new_style = self.convert_style_data(attr_value) | 169 new_style = self.convert_style_data(attr_value) |
| 170 converted = re.sub(re.escape(attr_value), new_style, converted) | 170 converted = re.sub(re.escape(attr_value), new_style, converted) |
| 171 if attr_name == 'class' and 'instructions' in attr_value: | |
| 172 # Always hide instructions, they're for manual testers. | |
| 173 converted = re.sub(r' style=".*?"', '', converted) | |
| 174 converted = re.sub(r'\>', ' style="display:none">', converted) | |
| 175 | 171 |
| 176 src_tags = ('script', 'img', 'style', 'frame', 'iframe', 'input', 'layer
', 'textarea', 'video', 'audio') | 172 src_tags = ('script', 'img', 'style', 'frame', 'iframe', 'input', 'layer
', 'textarea', 'video', 'audio') |
| 177 if tag in src_tags and self.reference_support_info is not None and self.
reference_support_info != {}: | 173 if tag in src_tags and self.reference_support_info is not None and self.
reference_support_info != {}: |
| 178 for attr_name, attr_value in attrs: | 174 for attr_name, attr_value in attrs: |
| 179 if attr_name == 'src': | 175 if attr_name == 'src': |
| 180 new_path = self.convert_reference_relpaths(attr_value) | 176 new_path = self.convert_reference_relpaths(attr_value) |
| 181 converted = re.sub(re.escape(attr_value), new_path, converte
d) | 177 converted = re.sub(re.escape(attr_value), new_path, converte
d) |
| 182 | 178 |
| 183 self.converted_data.append(converted) | 179 self.converted_data.append(converted) |
| 184 | 180 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 self.converted_data.extend(['&#', name, ';']) | 213 self.converted_data.extend(['&#', name, ';']) |
| 218 | 214 |
| 219 def handle_comment(self, data): | 215 def handle_comment(self, data): |
| 220 self.converted_data.extend(['<!--', data, '-->']) | 216 self.converted_data.extend(['<!--', data, '-->']) |
| 221 | 217 |
| 222 def handle_decl(self, decl): | 218 def handle_decl(self, decl): |
| 223 self.converted_data.extend(['<!', decl, '>']) | 219 self.converted_data.extend(['<!', decl, '>']) |
| 224 | 220 |
| 225 def handle_pi(self, data): | 221 def handle_pi(self, data): |
| 226 self.converted_data.extend(['<?', data, '>']) | 222 self.converted_data.extend(['<?', data, '>']) |
| OLD | NEW |