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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 structured = [] | 328 structured = [] |
329 stack = [{"level": 0, "subitems": structured}] | 329 stack = [{"level": 0, "subitems": structured}] |
330 for item in flat: | 330 for item in flat: |
331 while stack[-1]["level"] >= item["level"]: | 331 while stack[-1]["level"] >= item["level"]: |
332 stack.pop() | 332 stack.pop() |
333 stack[-1]["subitems"].append(item) | 333 stack[-1]["subitems"].append(item) |
334 stack.append(item) | 334 stack.append(item) |
335 return structured | 335 return structured |
336 | 336 |
337 converters = { | 337 converters = { |
338 "raw": RawConverter, # deprecated, will be removed soon | |
339 "html": RawConverter, | 338 "html": RawConverter, |
340 "md": MarkdownConverter, | 339 "md": MarkdownConverter, |
341 "tmpl": TemplateConverter, | 340 "tmpl": TemplateConverter, |
342 } | 341 } |
OLD | NEW |