Commit dcc24ff2 authored by Andreas Jung's avatar Andreas Jung

Multiple links in a paragraph with mixed link notation

(quotation+colon+URL or quotation+comma+whitespace+URL) did not
work properly (thanks to Alastair Burt for reporting and submitting
the patch).
parent 264612cd
......@@ -297,7 +297,8 @@ class DocumentClass:
]
text_types = [
'doc_href',
'doc_href1',
'doc_href2',
'doc_strong',
'doc_emphasize',
'doc_literal',
......@@ -651,14 +652,21 @@ class DocumentClass:
else:
return None
def doc_href(
self, s,
expr1 = re.compile("(\"[ %s0-9\n\-\.\,\;\(\)\/\:\/\*\']+\")(:)([a-zA-Z0-9\@\.\,\?\!\/\:\;\-\#\~]+)([,]*\s*)" % letters).search,
expr2 = re.compile('(\"[ %s0-9\n\-\.\:\;\(\)\/\*\']+\")([,]+\s+)([a-zA-Z0-9\@\.\,\?\!\/\:\;\-\#\~]+)(\s*)' % letters).search,
punctuation = re.compile("[\,\.\?\!\;]+").match
def doc_href1(self, s,
expr=re.compile("(\"[ %s0-9\n\-\.\,\;\(\)\/\:\/\*\']+\")(:)([a-zA-Z0-9\@\.\,\?\!\/\:\;\-\#\~]+)([,]*\s*)" % letters).search
):
return self.doc_href(s, expr)
r=expr1(s) or expr2(s)
def doc_href2(self, s,
expr=re.compile('(\"[ %s0-9\n\-\.\:\;\(\)\/\*\']+\")([,]+\s+)([a-zA-Z0-9\@\.\,\?\!\/\:\;\-\#\~]+)(\s*)' % letters).search
):
return self.doc_href(s, expr)
def doc_href(self, s, expr, punctuation = re.compile("[\,\.\?\!\;]+").match):
r=expr(s)
if r:
# need to grab the href part and the
......
......@@ -368,7 +368,8 @@ class DocumentClass:
#'doc_underline'
text_types = [
'doc_sgml',
'doc_href',
'doc_href1',
'doc_href2',
'doc_strong',
'doc_emphasize',
'doc_underline',
......@@ -956,12 +957,21 @@ class DocumentClass:
_SPACES = r'(\s*)'
def doc_href(self, s,
expr1 = re.compile(_DQUOTEDTEXT + "(:)" + _ABS_AND_RELATIVE_URL + _SPACES).search,
expr2 = re.compile(_DQUOTEDTEXT + r'(\,\s+)' + _ABSOLUTE_URL + _SPACES).search):
punctuation = re.compile(r"[\,\.\?\!\;]+").match
r=expr1(s) or expr2(s)
def doc_href1(self, s,
expr=re.compile(_DQUOTEDTEXT + "(:)" + _ABS_AND_RELATIVE_URL + _SPACES).search
):
return self.doc_href(s, expr)
def doc_href2(self, s,
expr=re.compile(_DQUOTEDTEXT + r'(\,\s+)' + _ABSOLUTE_URL + _SPACES).search
):
return self.doc_href(s, expr)
def doc_href(self, s, expr, punctuation=re.compile(r"[\,\.\?\!\;]+").match):
r=expr(s)
if r:
# need to grab the href part and the
......
......@@ -14,8 +14,11 @@
<li><p>please click <a href="http://www.zope.org:2001/members/">here</a>" </p></li>
<li><p>please click <a href="http://www.zope.org:2001/%20/Members/zope?a=222&b=213&_xc=just%20a%20test">here</a> </p></li>
<li><p>please click <a href="http://www.zope.org:2001/%20/Members/zope?a=222&b=213&_xc=just%20a%20test">here</a> </p></li>
<li><p>please click <a href="http://www.zope.org:2001/%20/Members/zope?a=222&b=213&_xc=just%20a%20test">here</a> </p></li>
</ul>
<p> And now a paragraph with <a href="http://www.zope-rocks.org">Link 1</a> and
<a href="http://www.zope-is-kewl.com">Link 2</a> and <a href="http://www.freshmeat.net">one more link - yeah.</a></p>
</body>
</html>
......@@ -16,3 +16,9 @@ This is LinkTest
- please click "here":http://www.zope.org:2001/%20/Members/zope?a=222&b=213&_xc=just%20a%20test
- please click "here", http://www.zope.org:2001/%20/Members/zope?a=222&b=213&_xc=just%20a%20test
And now a paragraph with "Link 1":http://www.zope-rocks.org and
"Link 2":http://www.zope-is-kewl.com and "one more link - yeah.":http://www.freshmeat.net
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment