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
113fc84a
Commit
113fc84a
authored
Apr 09, 2005
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Collector #1750: StructuredText: fixed handling of image URLs
with query string i - some more unittests
parent
a69fba72
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
8 deletions
+30
-8
doc/CHANGES.txt
doc/CHANGES.txt
+3
-0
lib/python/StructuredText/DocumentWithImages.py
lib/python/StructuredText/DocumentWithImages.py
+4
-4
lib/python/StructuredText/tests/testStructuredText.py
lib/python/StructuredText/tests/testStructuredText.py
+23
-4
No files found.
doc/CHANGES.txt
View file @
113fc84a
...
...
@@ -29,6 +29,9 @@ Zope Changes
Bugs fixed
- Collector #1750: StructuredText: fixed handling of image URLs
with query string
- Collector #1748: Fixed SIGSEGV in Acquisition
- Hotfix_20050405: classes defined in untrusted code could shadow
...
...
lib/python/StructuredText/DocumentWithImages.py
View file @
113fc84a
...
...
@@ -18,19 +18,19 @@ class StructuredTextImage(StructuredTextMarkup):
"A simple embedded image"
class
DocumentWithImages
(
DocumentClass
):
"""
"""
""" Document with images """
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,
expr1
=
re
.
compile
(
'
\
"
([ _a-zA-Z0-9*.:/;,
\
-
\
n
\
~]+)
\
":img:([a-zA-Z0-9
%
\
_
\
-.:/
\
?=
;,
\
n
\
~]+)
'
).search,
):
r=expr1(s)
if r:
startt, endt = r.span(1)
...
...
lib/python/StructuredText/tests/testStructuredText.py
View file @
113fc84a
...
...
@@ -138,7 +138,7 @@ class BasicTests(unittest.TestCase):
if
not
isinstance
(
stxtxt
,
UnicodeType
):
res
=
HTML
(
stxtxt
,
level
=
1
,
header
=
0
)
if
res
.
find
(
expected
)
==-
1
:
if
not
expected
in
res
:
print
"Text: "
,
stxtxt
print
"Converted:"
,
res
print
"Expected: "
,
expected
...
...
@@ -148,8 +148,10 @@ class BasicTests(unittest.TestCase):
ustxtxt
=
stxtxt
else
:
ustxtxt
=
unicode
(
stxtxt
)
res
=
HTML
(
ustxtxt
,
level
=
1
,
header
=
0
)
if
res
.
find
(
expected
)
==-
1
:
if
not
expected
in
res
:
print
"Text: "
,
stxtxt
.
encode
(
'latin-1'
)
print
"Converted:"
,
res
.
encode
(
'latin-1'
)
print
"Expected: "
,
expected
.
encode
(
'latin-1'
)
...
...
@@ -210,12 +212,29 @@ class BasicTests(unittest.TestCase):
'<code>"literal":http://www.zope.org/.</code>'
)
def
testLink
(
self
):
self
.
_test
(
'"foo":http://www.zope.org/foo/bar'
,
'<p><a href="http://www.zope.org/foo/bar">foo</a></p>'
)
self
.
_test
(
'"foo":http://www.zope.org/foo/bar/%20x'
,
'<p><a href="http://www.zope.org/foo/bar/%20x">foo</a></p>'
)
self
.
_test
(
'"foo":http://www.zope.org/foo/bar?arg1=1&arg2=2'
,
'<p><a href="http://www.zope.org/foo/bar?arg1=1&arg2=2">foo</a></p>'
)
def
testImgLink
(
self
):
self
.
_test
(
'"foo":img:http://www.zope.org/bar.gif'
,
'<
p><img src="http://www.zope.org/bar.gif" alt="foo" /
>'
)
'<
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" />'
)
'<img src="http://www.zope.org:8080/bar.gif" alt="foo">'
)
self
.
_test
(
'"foo":img:http://www.zope.org:8080/foo/bar?arg=1'
,
'<img src="http://www.zope.org:8080/foo/bar?arg=1" alt="foo">'
)
self
.
_test
(
'"foo":img:http://www.zope.org:8080/foo/b%20ar?arg=1'
,
'<img src="http://www.zope.org:8080/foo/b%20ar?arg=1" alt="foo">'
)
def
XXXtestUnicodeContent
(
self
):
# This fails because ST uses the default locale to get "letters"
...
...
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