Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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
edx-platform
Commits
54394cf7
Commit
54394cf7
authored
Oct 26, 2015
by
Sarina Canelake
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10325 from stvstnfrd/debt/wiki-image
Remove disabled wiki plugin
parents
6bbc37de
d57f6ab6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
72 deletions
+0
-72
lms/djangoapps/course_wiki/plugins/markdownedx/mdx_image.py
+0
-71
lms/djangoapps/course_wiki/plugins/markdownedx/wiki_plugin.py
+0
-1
No files found.
lms/djangoapps/course_wiki/plugins/markdownedx/mdx_image.py
View file @
54394cf7
#!/usr/bin/env python
'''
Image Embedding Extension for Python-Markdown
======================================
Converts lone links to embedded images, provided the file extension is allowed.
Ex:
http://www.ericfehse.net/media/img/ef/blog/django-pony.jpg
becomes
<img src="http://www.ericfehse.net/media/img/ef/blog/django-pony.jpg">
mypic.jpg becomes <img src="/MEDIA_PATH/mypic.jpg">
Requires Python-Markdown 1.6+
'''
import
simplewiki.settings
as
settings
import
markdown
try
:
# Markdown 2.1.0 changed from 2.0.3. We try importing the new version first,
# but import the 2.0.3 version if it fails
from
markdown.util
import
etree
except
:
from
markdown
import
etree
class
ImageExtension
(
markdown
.
Extension
):
def
__init__
(
self
,
configs
):
for
key
,
value
in
configs
:
self
.
setConfig
(
key
,
value
)
def
add_inline
(
self
,
md
,
name
,
klass
,
re
):
pattern
=
klass
(
re
)
pattern
.
md
=
md
pattern
.
ext
=
self
md
.
inlinePatterns
.
add
(
name
,
pattern
,
"<reference"
)
def
extendMarkdown
(
self
,
md
,
md_globals
):
self
.
add_inline
(
md
,
'image'
,
ImageLink
,
r'^(?P<proto>([^:/?#])+://)?(?P<domain>([^/?#]*)/)?(?P<path>[^?#]*\.(?P<ext>[^?#]{3,4}))(?:\?([^#]*))?(?:#(.*))?$'
)
class
ImageLink
(
markdown
.
inlinepatterns
.
Pattern
):
def
handleMatch
(
self
,
m
):
img
=
etree
.
Element
(
'img'
)
proto
=
m
.
group
(
'proto'
)
or
"http://"
domain
=
m
.
group
(
'domain'
)
path
=
m
.
group
(
'path'
)
ext
=
m
.
group
(
'ext'
)
# A fixer upper
if
ext
.
lower
()
in
settings
.
WIKI_IMAGE_EXTENSIONS
:
if
domain
:
src
=
proto
+
domain
+
path
elif
path
:
# We need a nice way to source local attachments...
src
=
"/wiki/media/"
+
path
+
".upload"
else
:
src
=
''
img
.
set
(
'src'
,
src
)
return
img
def
makeExtension
(
configs
=
None
):
return
ImageExtension
(
configs
=
configs
)
if
__name__
==
"__main__"
:
import
doctest
doctest
.
testmod
()
lms/djangoapps/course_wiki/plugins/markdownedx/wiki_plugin.py
View file @
54394cf7
...
...
@@ -12,7 +12,6 @@ class ExtendMarkdownPlugin(BasePlugin):
"""
markdown_extensions
=
[
mdx_circuit
.
CircuitExtension
(
configs
=
{}),
#mdx_image.ImageExtension() , #This one doesn't work. Tries to import simplewiki.settings
mdx_mathjax
.
MathJaxExtension
(
configs
=
{}),
mdx_video
.
VideoExtension
(
configs
=
{})]
...
...
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