Index: includes/toc.tmpl |
diff --git a/includes/toc.tmpl b/includes/toc.tmpl |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ea04142e635a4d0bc0ae241a6dd58a7de9be2976 |
--- /dev/null |
+++ b/includes/toc.tmpl |
@@ -0,0 +1,33 @@ |
+{# |
+ # This file is part of the Adblock Plus website, |
+ # Copyright (C) 2006-2015 Eyeo GmbH |
+ # |
+ # Adblock Plus is free software: you can redistribute it and/or modify |
+ # it under the terms of the GNU General Public License version 3 as |
+ # published by the Free Software Foundation. |
+ # |
+ # Adblock Plus is distributed in the hope that it will be useful, |
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of |
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
+ # GNU General Public License for more details. |
+ # |
+ # You should have received a copy of the GNU General Public License |
+ # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
+ #} |
+ |
+{% macro toc(page, title_tag=None) %} |
+ {% set page_content = get_page_content(page) %} |
+ {% set toclist = page_content["body"]|toclist %} |
+ |
+ {% if title_tag %} |
+ <{{ title_tag }}>{{ page_content["title"] }}</{{ title_tag }}> |
+ {% endif %} |
+ <ul> |
+ {% for item in toclist %} |
+ <li> |
+ {{ (page + '#' + item.anchor)|linkify }}{{ item.title }}</a> |
+ {% if item.subitems %}{{ toc(item.subitems) }}{% endif %} |
+ </li> |
+ {% endfor %} |
+ </ul> |
+{% endmacro %} |