Browse files

Now accepting spaces inside angle-bracked-delimited URLs in inline an…

…d reference links.
  • Loading branch information...
1 parent 9b21cc6 commit bf6366481e68fc05301becbeef3fc292832f29af @michelf committed Dec 31, 2008
Showing with 10 additions and 5 deletions.
  1. +10 −5 markdown.php
View
15 markdown.php
@@ -332,14 +332,18 @@ function stripLinkDefinitions($text) {
[ ]*
\n? # maybe *one* newline
[ ]*
- <?(\S+?)>? # url = $2
+ (?:
+ <(.+?)> # url = $2
+ |
+ (\S+?) # url = $3
+ )
[ ]*
\n? # maybe one newline
[ ]*
(?:
(?<=\s) # lookbehind for whitespace
["(]
- (.*?) # title = $3
+ (.*?) # title = $4
[")]
[ ]*
)? # title is optional
@@ -351,8 +355,9 @@ function stripLinkDefinitions($text) {
}
function _stripLinkDefinitions_callback($matches) {
$link_id = strtolower($matches[1]);
- $this->urls[$link_id] = $matches[2];
- $this->titles[$link_id] =& $matches[3];
+ $url = $matches[2] == '' ? $matches[3] : $matches[2];
+ $this->urls[$link_id] = $url;
+ $this->titles[$link_id] =& $matches[4];
return ''; # String that will replace the block
}
@@ -677,7 +682,7 @@ function doAnchors($text) {
\( # literal paren
[ ]*
(?:
- <(\S*)> # href = $3
+ <(.+?)> # href = $3
|
('.$this->nested_url_parenthesis_re.') # href = $4
)

0 comments on commit bf63664

Please sign in to comment.