Left: | ||
Right: |
OLD | NEW |
---|---|
1 # This file is part of the Adblock Plus web scripts, | 1 # This file is part of the Adblock Plus web scripts, |
2 # Copyright (C) 2006-present eyeo GmbH | 2 # Copyright (C) 2006-present eyeo GmbH |
3 # | 3 # |
4 # Adblock Plus is free software: you can redistribute it and/or modify | 4 # Adblock Plus is free software: you can redistribute it and/or modify |
5 # it under the terms of the GNU General Public License version 3 as | 5 # it under the terms of the GNU General Public License version 3 as |
6 # published by the Free Software Foundation. | 6 # published by the Free Software Foundation. |
7 # | 7 # |
8 # Adblock Plus is distributed in the hope that it will be useful, | 8 # Adblock Plus is distributed in the hope that it will be useful, |
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
319 post += ' hreflang="{}"'\ | 319 post += ' hreflang="{}"'\ |
320 .format(jinja2.Markup.escape(locale)) | 320 .format(jinja2.Markup.escape(locale)) |
321 | 321 |
322 if self._params['relative']: | 322 if self._params['relative']: |
323 current_page = '/{}/{}'.format(self._params['locale'], | 323 current_page = '/{}/{}'.format(self._params['locale'], |
324 self._params['page']) | 324 self._params['page']) |
325 url = make_relative(current_page, url) | 325 url = make_relative(current_page, url) |
326 | 326 |
327 return ''.join((pre, jinja2.Markup.escape(url), post)) | 327 return ''.join((pre, jinja2.Markup.escape(url), post)) |
328 | 328 |
329 text = re.sub(r'(<a\s[^<>]*\b(href)=\")([^<>\"]+)(\")', | 329 text = re.sub(r'(<[\w]+\s[^<>]*\b(href)=\")([^<>\"]+)(\")', |
Vasily Kuznetsov
2019/01/04 20:16:56
Perhaps at this point it makes sense to combine th
rhowell
2019/01/07 22:25:06
Good idea, done.
| |
330 process_link, text) | 330 process_link, text) |
331 text = re.sub(r'(<img\s[^<>]*\b(src)=\")([^<>\"]+)(\")', | 331 text = re.sub(r'(<[\w]+\s[^<>]*\b(src)=\")([^<>\"]+)(\")', |
332 process_link, text) | 332 process_link, text) |
333 return text | 333 return text |
334 | 334 |
335 include_start_regex = '<' | 335 include_start_regex = '<' |
336 include_end_regex = '>' | 336 include_end_regex = '>' |
337 | 337 |
338 def resolve_includes(self, text): | 338 def resolve_includes(self, text): |
339 def resolve_include(match): | 339 def resolve_include(match): |
340 name = match.group(1) | 340 name = match.group(1) |
341 for format_, converter_class in converters.iteritems(): | 341 for format_, converter_class in converters.iteritems(): |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
589 stack[-1]['subitems'].append(item) | 589 stack[-1]['subitems'].append(item) |
590 stack.append(item) | 590 stack.append(item) |
591 return structured | 591 return structured |
592 | 592 |
593 | 593 |
594 converters = { | 594 converters = { |
595 'html': RawConverter, | 595 'html': RawConverter, |
596 'md': MarkdownConverter, | 596 'md': MarkdownConverter, |
597 'tmpl': TemplateConverter, | 597 'tmpl': TemplateConverter, |
598 } | 598 } |
OLD | NEW |