Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
a1a96235
Commit
a1a96235
authored
Nov 28, 2004
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Collector #631: Image URLs in StructuredText containing port
numbers were not rendered correctly
parent
53a2e5d2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
24 deletions
+10
-24
doc/CHANGES.txt
doc/CHANGES.txt
+3
-0
lib/python/StructuredText/DocumentWithImages.py
lib/python/StructuredText/DocumentWithImages.py
+0
-24
lib/python/StructuredText/tests/testStructuredText.py
lib/python/StructuredText/tests/testStructuredText.py
+7
-0
No files found.
doc/CHANGES.txt
View file @
a1a96235
...
...
@@ -46,6 +46,9 @@ Zope Changes
Bugs fixed
- Collector #631: Image URLs in StructuredText containing port
numbers were not rendered correctly
- Collector #1498: Don't choke on malformed cookies. Cookies of
the form "foo=bar; hmm; baz=gee" will give an empty value for
'hmm' instead of silently discarding it and the rest of the
...
...
lib/python/StructuredText/DocumentWithImages.py
View file @
a1a96235
...
...
@@ -22,39 +22,15 @@ class DocumentWithImages(DocumentClass):
"""
text_types
=
[
'doc_img'
,
]
+
DocumentClass
.
text_types
def
doc_img
(
self
,
s
,
expr1
=
re
.
compile
(
'
\
"
([ _a-zA-Z0-9*.:/;,
\
-
\
n
\
~]+)
\
":img:([a-zA-Z0-9
\
_
\
-.:/;,
\
n
\
~]+)
'
).search,
expr2=re.compile('
\
"([ _a-zA-Z0-9*.:/;,
\
-
\
n
\
~]+)
\
"
:
img
:([
a
-
zA
-
Z0
-
9
\
_
\
-
.:
/
;,
\
n
\
~
]
+
):([
a
-
zA
-
Z0
-
9
_
\
-
.:
/
;,
\
n
\
~
]
+
)
').search
):
r = expr2(s)
if r:
# Warning: the regex are getting confused when the string after :img:
# is an URL containing ":" (Collector #2276)
# Ugly workaround: check if have an absolute URL here. Not a cool solution,
# but it works !
if not r.group(2) in ['
http
','
file
','
ftp
']:
startt, endt = r.span(1)
startk, endk = r.span(2)
starth, endh = r.span(3)
start, end = r.span()
key = s[startk:endk]
return (StructuredTextImage(s[startt:endt], href=s[starth:endh], key=s[startk:endk]),
start, end)
r=expr1(s)
if r:
startt, endt = r.span(1)
...
...
lib/python/StructuredText/tests/testStructuredText.py
View file @
a1a96235
...
...
@@ -210,6 +210,13 @@ class BasicTests(unittest.TestCase):
'<code>"literal":http://www.zope.org/.</code>'
)
def
testImgLink
(
self
):
self
.
_test
(
'"foo":img:http://www.zope.org/bar.gif'
,
'<p><img src="http://www.zope.org/bar.gif" alt="foo" />'
)
self
.
_test
(
'"foo":img:http://www.zope.org:8080/bar.gif'
,
'<p><img src="http://www.zope.org:8080/bar.gif" alt="foo" />'
)
def
XXXtestUnicodeContent
(
self
):
# This fails because ST uses the default locale to get "letters"
# whereas it should use \w+ and re.U if the string is Unicode.
...
...
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