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
edx
django-wiki
Commits
913c386e
Commit
913c386e
authored
Feb 06, 2018
by
Jeremy Bowman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PLAT-1945 Fix deprecated Markdown extension initialization
parent
b108ad30
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
20 deletions
+24
-20
setup.py
+1
-1
wiki/plugins/links/mdx/djangowikilinks.py
+12
-10
wiki/plugins/links/mdx/urlize.py
+7
-6
wiki/plugins/links/wiki_plugin.py
+4
-3
No files found.
setup.py
View file @
913c386e
...
...
@@ -29,7 +29,7 @@ package_data = dict(
setup
(
name
=
"django-wiki"
,
version
=
"0.0.1
6
"
,
version
=
"0.0.1
7
"
,
author
=
"Benjamin Bach"
,
author_email
=
"benjamin@overtag.dk"
,
description
=
(
"A wiki system written for the Django framework."
),
...
...
wiki/plugins/links/mdx/djangowikilinks.py
View file @
913c386e
...
...
@@ -30,20 +30,19 @@ try:
except
ImportError
:
from
markdown
import
etree
#@UnresolvedImport @Reimport
class
WikiPathExtension
(
markdown
.
Extension
):
def
__init__
(
self
,
confi
gs
):
def
__init__
(
self
,
**
kwar
gs
):
# set extension defaults
self
.
config
=
{
'base_url'
:
[
'/'
,
'String to append to beginning of URL.'
],
'html_class'
:
[
'wikipath'
,
'CSS hook. Leave blank for none.'
],
'live_lookups'
:
[
True
,
'If the plugin should try and match links to real articles'
],
'default_level'
:
[
2
,
'The level that most articles are created at. Relative links will tend to start at that level.'
]
'base_url'
:
[
'/'
,
'String to append to beginning of URL.'
],
'html_class'
:
[
'wikipath'
,
'CSS hook. Leave blank for none.'
],
'live_lookups'
:
[
True
,
'If the plugin should try and match links to real articles'
],
'default_level'
:
[
2
,
'The level that most articles are created at. Relative links will tend to start at that level.'
]
}
# Override defaults with user settings
for
key
,
value
in
configs
:
# self.config[key][0] = value
self
.
setConfig
(
key
,
value
)
super
(
WikiPathExtension
,
self
)
.
__init__
(
**
kwargs
)
def
extendMarkdown
(
self
,
md
,
md_globals
):
self
.
md
=
md
...
...
@@ -54,6 +53,7 @@ class WikiPathExtension(markdown.Extension):
wikiPathPattern
.
md
=
md
md
.
inlinePatterns
.
add
(
'djangowikipath'
,
wikiPathPattern
,
"<reference"
)
class
WikiPath
(
markdown
.
inlinepatterns
.
Pattern
):
def
__init__
(
self
,
pattern
,
config
,
**
kwargs
):
markdown
.
inlinepatterns
.
Pattern
.
__init__
(
self
,
pattern
,
**
kwargs
)
...
...
@@ -130,8 +130,10 @@ class WikiPath(markdown.inlinepatterns.Pattern):
html_class
=
self
.
md
.
Meta
[
'wiki_html_class'
][
0
]
return
base_url
,
html_class
def
makeExtension
(
configs
=
None
)
:
return
WikiPathExtension
(
configs
=
configs
)
def
makeExtension
(
**
kwargs
):
return
WikiPathExtension
(
**
kwargs
)
if
__name__
==
"__main__"
:
import
doctest
...
...
wiki/plugins/links/mdx/urlize.py
View file @
913c386e
...
...
@@ -54,6 +54,7 @@ URLIZE_RE = (
r'(?:/?|[/?]\S+))'
)
class
UrlizePattern
(
markdown
.
inlinepatterns
.
Pattern
):
def
__init__
(
self
,
pattern
,
markdown_instance
=
None
):
...
...
@@ -87,6 +88,7 @@ class UrlizePattern(markdown.inlinepatterns.Pattern):
el
.
extend
([
icon
,
span_text
])
return
el
class
UrlizeExtension
(
markdown
.
Extension
):
""" Urlize Extension for Python-Markdown. """
...
...
@@ -94,11 +96,11 @@ class UrlizeExtension(markdown.Extension):
""" Replace autolink with UrlizePattern """
md
.
inlinePatterns
[
'autolink'
]
=
UrlizePattern
(
URLIZE_RE
,
md
)
def
makeExtension
(
configs
=
None
):
if
configs
is
None
:
configs
=
{}
return
UrlizeExtension
(
configs
=
configs
)
def
makeExtension
(
**
kwargs
)
:
return
UrlizeExtension
(
**
kwargs
)
if
__name__
==
"__main__"
:
import
doctest
doctest
.
testmod
()
\ No newline at end of file
doctest
.
testmod
()
wiki/plugins/links/wiki_plugin.py
View file @
913c386e
...
...
@@ -10,6 +10,7 @@ from wiki.plugins.links.mdx.urlize import makeExtension
from
wiki.plugins.links.mdx.djangowikilinks
import
WikiPathExtension
from
django.core.urlresolvers
import
reverse_lazy
class
LinkPlugin
(
BasePlugin
):
slug
=
'links'
...
...
@@ -29,10 +30,10 @@ class LinkPlugin(BasePlugin):
(
'default_level'
,
settings
.
LINK_DEFAULT_LEVEL
),
]
markdown_extensions
=
[
makeExtension
(),
WikiPathExtension
(
wikipath_config
)]
markdown_extensions
=
[
makeExtension
(),
WikiPathExtension
(
**
dict
(
wikipath_config
)
)]
def
__init__
(
self
):
pass
registry
.
register
(
LinkPlugin
)
registry
.
register
(
LinkPlugin
)
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