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
46c48575
Commit
46c48575
authored
Aug 21, 2012
by
benjaoming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Image captions should keep line breaks. Missing image files still keep causing problems
parent
5b49a60a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
5 deletions
+4
-5
wiki/plugins/images/markdown_extensions.py
+4
-3
wiki/plugins/images/models.py
+0
-2
No files found.
wiki/plugins/images/markdown_extensions.py
View file @
46c48575
...
@@ -26,7 +26,7 @@ class ImagePreprocessor(markdown.preprocessors.Preprocessor):
...
@@ -26,7 +26,7 @@ class ImagePreprocessor(markdown.preprocessors.Preprocessor):
image
=
None
image
=
None
image_id
=
None
image_id
=
None
alignment
=
None
alignment
=
None
caption
=
""
caption
_lines
=
[]
for
line
in
lines
:
for
line
in
lines
:
m
=
IMAGE_RE
.
match
(
line
)
m
=
IMAGE_RE
.
match
(
line
)
if
m
:
if
m
:
...
@@ -42,12 +42,13 @@ class ImagePreprocessor(markdown.preprocessors.Preprocessor):
...
@@ -42,12 +42,13 @@ class ImagePreprocessor(markdown.preprocessors.Preprocessor):
line
=
line
.
replace
(
m
.
group
(
1
),
""
)
line
=
line
.
replace
(
m
.
group
(
1
),
""
)
elif
previous_line_was_image
:
elif
previous_line_was_image
:
if
line
.
startswith
(
" "
):
if
line
.
startswith
(
" "
):
caption
+=
line
[
3
:]
caption
_lines
.
append
(
line
[
4
:])
line
=
None
line
=
None
else
:
else
:
html
=
render_to_string
(
"wiki/plugins/images/render.html"
,
html
=
render_to_string
(
"wiki/plugins/images/render.html"
,
Context
({
'image'
:
image
,
Context
({
'image'
:
image
,
'caption'
:
article_markdown
(
caption
,
self
.
markdown
.
article
,
'caption'
:
article_markdown
(
"
\n
"
.
join
(
caption_lines
),
self
.
markdown
.
article
,
extensions
=
self
.
markdown
.
registeredExtensions
),
extensions
=
self
.
markdown
.
registeredExtensions
),
'align'
:
alignment
}))
'align'
:
alignment
}))
line
=
html
+
line
line
=
html
+
line
...
...
wiki/plugins/images/models.py
View file @
46c48575
...
@@ -84,8 +84,6 @@ class ImageRevision(RevisionPluginRevision):
...
@@ -84,8 +84,6 @@ class ImageRevision(RevisionPluginRevision):
self
.
height
=
predecessor
.
height
self
.
height
=
predecessor
.
height
except
IOError
:
except
IOError
:
self
.
image
=
None
self
.
image
=
None
self
.
width
=
None
self
.
height
=
None
class
Meta
:
class
Meta
:
verbose_name
=
_
(
u'image revision'
)
verbose_name
=
_
(
u'image revision'
)
...
...
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