Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-wiki
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
django-wiki
Commits
f14ecefa
Commit
f14ecefa
authored
Jan 28, 2013
by
tschmidt-dev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
collapsed MARKDOWN_EXTENSIONS and MARKDOWN_SAFE_MODE settings into MARKDOWN_KWARGS
parent
0f02092a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
+7
-7
wiki/conf/settings.py
+2
-2
wiki/core/__init__.py
+4
-1
wiki/models/article.py
+1
-4
No files found.
wiki/conf/settings.py
View file @
f14ecefa
...
@@ -13,8 +13,8 @@ WIKI_LANGUAGE = 'markdown'
...
@@ -13,8 +13,8 @@ WIKI_LANGUAGE = 'markdown'
# extend the built-in editor and customize it....
# extend the built-in editor and customize it....
EDITOR
=
getattr
(
django_settings
,
'WIKI_EDITOR'
,
'wiki.editors.markitup.MarkItUp'
)
EDITOR
=
getattr
(
django_settings
,
'WIKI_EDITOR'
,
'wiki.editors.markitup.MarkItUp'
)
MARKDOWN_
EXTENSIONS
=
getattr
(
django_settings
,
'WIKI_MARKDOWN_EXTENSIONS'
,
[
'extra'
,
'toc'
]
)
MARKDOWN_
KWARGS
=
{
'extensions'
:
[
'extra'
,
'toc'
],
'safe_mode'
:
'replace'
}
MARKDOWN_
SAFE_MODE
=
getattr
(
django_settings
,
'WIKI_MARKDOWN_SAFE_MODE'
,
'remove'
)
MARKDOWN_
KWARGS
.
update
(
getattr
(
django_settings
,
'WIKI_MARKDOWN_KWARGS'
,
{}
)
)
# This slug is used in URLPath if an article has been deleted. The children of the
# 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
# URLPath of that article are moved to lost and found. They keep their permissions
...
...
wiki/core/__init__.py
View file @
f14ecefa
import
markdown
import
markdown
from
wiki.core.plugins
import
registry
as
plugin_registry
from
wiki.conf
import
settings
from
wiki.conf
import
settings
class
ArticleMarkdown
(
markdown
.
Markdown
):
class
ArticleMarkdown
(
markdown
.
Markdown
):
def
__init__
(
self
,
article
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
article
,
*
args
,
**
kwargs
):
kwargs
[
'safe_mode'
]
=
settings
.
MARKDOWN_SAFE_MODE
kwargs
=
settings
.
MARKDOWN_KWARGS
kwargs
[
'extensions'
]
=
kwargs
.
get
(
'extensions'
,
[])
kwargs
[
'extensions'
]
+=
plugin_registry
.
get_markdown_extensions
()
markdown
.
Markdown
.
__init__
(
self
,
*
args
,
**
kwargs
)
markdown
.
Markdown
.
__init__
(
self
,
*
args
,
**
kwargs
)
self
.
article
=
article
self
.
article
=
article
...
...
wiki/models/article.py
View file @
f14ecefa
...
@@ -8,7 +8,6 @@ from django.utils.translation import ugettext_lazy as _
...
@@ -8,7 +8,6 @@ from django.utils.translation import ugettext_lazy as _
from
wiki.conf
import
settings
from
wiki.conf
import
settings
from
wiki.core
import
article_markdown
,
permissions
from
wiki.core
import
article_markdown
,
permissions
from
wiki.core.plugins
import
registry
as
plugin_registry
from
wiki
import
managers
from
wiki
import
managers
from
mptt.models
import
MPTTModel
from
mptt.models
import
MPTTModel
...
@@ -183,9 +182,7 @@ class Article(models.Model):
...
@@ -183,9 +182,7 @@ class Article(models.Model):
content
=
preview_content
content
=
preview_content
else
:
else
:
content
=
self
.
current_revision
.
content
content
=
self
.
current_revision
.
content
extensions
=
plugin_registry
.
get_markdown_extensions
()
return
mark_safe
(
article_markdown
(
content
,
self
))
extensions
+=
settings
.
MARKDOWN_EXTENSIONS
return
mark_safe
(
article_markdown
(
content
,
self
,
extensions
=
extensions
))
class
ArticleForObject
(
models
.
Model
):
class
ArticleForObject
(
models
.
Model
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment