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 |
11 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
12 # | 12 # |
13 # You should have received a copy of the GNU General Public License | 13 # You should have received a copy of the GNU General Public License |
14 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 14 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
15 | 15 |
16 import re | 16 import re |
17 | 17 |
18 __all__ = [ | 18 __all__ = [ |
19 'get_page_params', | 19 'get_page_params', |
20 'process_page', | 20 'process_page', |
21 'split_head_body', | 21 'split_head_body', |
22 'extract_page_metadata' | 22 'extract_page_metadata', |
23 ] | 23 ] |
24 | 24 |
25 | 25 |
26 def split_head_body(html): | 26 def split_head_body(html): |
27 """Split HTML page into head and remaining content. | 27 """Split HTML page into head and remaining content. |
28 | 28 |
29 This is used to pass head and body of the page to the template as two | 29 This is used to pass head and body of the page to the template as two |
30 separate variables. | 30 separate variables. |
31 | 31 |
32 Parameters | 32 Parameters |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 return params | 153 return params |
154 | 154 |
155 | 155 |
156 def process_page(source, locale, page, format=None, site_url_override=None, | 156 def process_page(source, locale, page, format=None, site_url_override=None, |
157 localized_string_callback=None): | 157 localized_string_callback=None): |
158 from cms.converters import TemplateConverter | 158 from cms.converters import TemplateConverter |
159 | 159 |
160 params = get_page_params(source, locale, page, format, site_url_override, | 160 params = get_page_params(source, locale, page, format, site_url_override, |
161 localized_string_callback) | 161 localized_string_callback) |
162 return TemplateConverter(*params['templatedata'], params=params)() | 162 return TemplateConverter(*params['templatedata'], params=params)() |
OLD | NEW |