~netlandish/django-wiki

91076f21d0215112c3ea0a607f00a039e24dc18d — benjaoming 11 years ago 933ac19
security fix for macro plugin, add plugins.acros to testproject
2 files changed, 6 insertions(+), 1 deletions(-)

M testproject/testproject/settings.py
M wiki/plugins/macros/markdown_extensions.py
M testproject/testproject/settings.py => testproject/testproject/settings.py +1 -0
@@ 109,6 109,7 @@ INSTALLED_APPS = (
    'wiki.plugins.images',
    'wiki.plugins.attachments',
    'wiki.plugins.notifications',
    'wiki.plugins.macros',
    'mptt',
    #'haystack',
)

M wiki/plugins/macros/markdown_extensions.py => wiki/plugins/macros/markdown_extensions.py +5 -1
@@ 18,13 18,17 @@ class MacroExtension(markdown.Extension):
class MacroPreprocessor(markdown.preprocessors.Preprocessor):
    """django-wiki macro preprocessor - parse text for various [some_macro] and 
    [some_macro:arg] references. """

    
    allowed_methods = ('article_list',)
    
    def run(self, lines):
        new_text = []
        for line in lines:
            m = MACRO_RE.match(line)
            if m:
                macro = m.group('macro').strip()
                if not macro in MacroPreprocessor.allowed_methods:
                    continue
                arg = m.group('arg')
                if arg:
                    arg = arg.strip()