OLD | NEW |
1 # coding: utf-8 | 1 # coding: utf-8 |
2 | 2 |
3 # This file is part of the Adblock Plus web scripts, | 3 # This file is part of the Adblock Plus web scripts, |
4 # Copyright (C) 2006-2015 Eyeo GmbH | 4 # Copyright (C) 2006-2015 Eyeo GmbH |
5 # | 5 # |
6 # Adblock Plus is free software: you can redistribute it and/or modify | 6 # Adblock Plus is free software: you can redistribute it and/or modify |
7 # it under the terms of the GNU General Public License version 3 as | 7 # it under the terms of the GNU General Public License version 3 as |
8 # published by the Free Software Foundation. | 8 # published by the Free Software Foundation. |
9 # | 9 # |
10 # Adblock Plus is distributed in the hope that it will be useful, | 10 # Adblock Plus is distributed in the hope that it will be useful, |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 # HTML escaping is applied when this string is inserted into the document. | 102 # HTML escaping is applied when this string is inserted into the document. |
103 self._append_text(data) | 103 self._append_text(data) |
104 | 104 |
105 def handle_entityref(self, name): | 105 def handle_entityref(self, name): |
106 self._append_text(self.unescape("&%s;" % name)) | 106 self._append_text(self.unescape("&%s;" % name)) |
107 | 107 |
108 def handle_charref(self, name): | 108 def handle_charref(self, name): |
109 self._append_text(self.unescape("&#%s;" % name)) | 109 self._append_text(self.unescape("&#%s;" % name)) |
110 | 110 |
111 class Converter: | 111 class Converter: |
112 whitelist = {"a", "em", "strong", "code", "span"} | 112 whitelist = {"a", "em", "sup", "strong", "code", "span"} |
113 missing_translations = 0 | 113 missing_translations = 0 |
114 total_translations = 0 | 114 total_translations = 0 |
115 | 115 |
116 def __init__(self, params, key="pagedata"): | 116 def __init__(self, params, key="pagedata"): |
117 self._params = params | 117 self._params = params |
118 self._key = key | 118 self._key = key |
119 self._attribute_parser = AttributeParser(self.whitelist) | 119 self._attribute_parser = AttributeParser(self.whitelist) |
120 self._seen_defaults = {} | 120 self._seen_defaults = {} |
121 | 121 |
122 # Read in any parameters specified at the beginning of the file | 122 # Read in any parameters specified at the beginning of the file |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 stack.pop() | 437 stack.pop() |
438 stack[-1]["subitems"].append(item) | 438 stack[-1]["subitems"].append(item) |
439 stack.append(item) | 439 stack.append(item) |
440 return structured | 440 return structured |
441 | 441 |
442 converters = { | 442 converters = { |
443 "html": RawConverter, | 443 "html": RawConverter, |
444 "md": MarkdownConverter, | 444 "md": MarkdownConverter, |
445 "tmpl": TemplateConverter, | 445 "tmpl": TemplateConverter, |
446 } | 446 } |
OLD | NEW |