~netlandish/django-wiki

0f02092a7a3b223023d97f1f1117d142f264ed2e — tschmidt-dev 11 years ago 8ac9814
added MARKDOWN_SAFE_MODE setting
2 files changed, 5 insertions(+), 1 deletions(-)

M wiki/conf/settings.py
M wiki/core/__init__.py
M wiki/conf/settings.py => wiki/conf/settings.py +1 -0
@@ 14,6 14,7 @@ WIKI_LANGUAGE = 'markdown'
EDITOR = getattr( django_settings, 'WIKI_EDITOR', 'wiki.editors.markitup.MarkItUp' )

MARKDOWN_EXTENSIONS = getattr( django_settings, 'WIKI_MARKDOWN_EXTENSIONS', ['extra', 'toc'] )
MARKDOWN_SAFE_MODE = getattr( django_settings, 'WIKI_MARKDOWN_SAFE_MODE', 'remove' )

# This slug is used in URLPath if an article has been deleted. The children of the
# URLPath of that article are moved to lost and found. They keep their permissions

M wiki/core/__init__.py => wiki/core/__init__.py +4 -1
@@ 1,9 1,12 @@
import markdown

from wiki.conf import settings


class ArticleMarkdown(markdown.Markdown):
    
    def __init__(self, article, *args, **kwargs):
        kwargs['safe_mode'] = "remove"
        kwargs['safe_mode'] = settings.MARKDOWN_SAFE_MODE 
        markdown.Markdown.__init__(self, *args, **kwargs)
        self.article = article