From 90703582542ef0105303727aded011ca07944866 Mon Sep 17 00:00:00 2001 From: benjaoming Date: Sun, 3 Feb 2013 15:08:25 +0100 Subject: [PATCH] Fix error in macros removing unknown tags from stack and prettify styling --- wiki/plugins/macros/markdown_extensions.py | 15 +++++++-------- .../wiki/plugins/macros/article_list.html | 13 ++++++------- wiki/templates/wiki/base.html | 3 ++- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/wiki/plugins/macros/markdown_extensions.py b/wiki/plugins/macros/markdown_extensions.py index 7c783d1e..9940a9fe 100644 --- a/wiki/plugins/macros/markdown_extensions.py +++ b/wiki/plugins/macros/markdown_extensions.py @@ -30,14 +30,13 @@ class MacroPreprocessor(markdown.preprocessors.Preprocessor): m = MACRO_RE.match(line) if m: macro = m.group('macro').strip() - if not macro in MacroPreprocessor.allowed_methods: - continue - kwargs = m.group('kwargs') - if kwargs: - kwargs = eval('{' + KWARG_RE.sub(r'"\1":"\2",', kwargs) + '}') - line = getattr(self, macro)(**kwargs) - else: - line = getattr(self, macro)() + if macro in MacroPreprocessor.allowed_methods: + kwargs = m.group('kwargs') + if kwargs: + kwargs = eval('{' + KWARG_RE.sub(r'"\1":"\2",', kwargs) + '}') + line = getattr(self, macro)(**kwargs) + else: + line = getattr(self, macro)() if not line is None: new_text.append(line) return new_text diff --git a/wiki/plugins/macros/templates/wiki/plugins/macros/article_list.html b/wiki/plugins/macros/templates/wiki/plugins/macros/article_list.html index 373cfafd..829e55ae 100644 --- a/wiki/plugins/macros/templates/wiki/plugins/macros/article_list.html +++ b/wiki/plugins/macros/templates/wiki/plugins/macros/article_list.html @@ -1,11 +1,10 @@ {% load i18n wiki_macro_tags %} {% if article_children %} -
-

{% trans "Articles" %}

-
- {% for child in article_children %} - {% article_list child depth %} - {% endfor %} -
+

{% trans "Articles" %}

+
+ {% for child in article_children %} + {% article_list child depth %} + {% endfor %} +
{% endif %} diff --git a/wiki/templates/wiki/base.html b/wiki/templates/wiki/base.html index 0aebcdc6..d14f12a0 100644 --- a/wiki/templates/wiki/base.html +++ b/wiki/templates/wiki/base.html @@ -40,7 +40,8 @@ #edit_sidebar .accordion {margin-bottom: 5px;} - .wiki-article div.toc { + .wiki-article div.toc, + .wiki-article div.article-list { margin: 10px 0; background: #f9f9f9; padding: 10px; -- 2.45.2