Skip to content

Commit

Permalink
URL shelving uses named sub-patterns.
Browse files Browse the repository at this point in the history
See #121
  • Loading branch information
Jukka Svahn committed Oct 31, 2013
1 parent 00c2ed4 commit a592335
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Netcarver/Textile/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -2820,7 +2820,7 @@ protected function shelveURL($text)

protected function retrieveURLs($text)
{
return preg_replace_callback('/'.$this->uid.'(\d+):url/', array(&$this, 'retrieveURL'), $text);
return preg_replace_callback('/'.$this->uid.'(?P<token>\d+):url/', array(&$this, 'retrieveURL'), $text);
}

/**
Expand All @@ -2832,12 +2832,11 @@ protected function retrieveURLs($text)

protected function retrieveURL($m)
{
$ref = $m[1];
if (!isset($this->refCache[$ref])) {
return $ref;
if (!isset($this->refCache[$m['token']])) {
return $m['token'];
}

$url = $this->refCache[$ref];
$url = $this->refCache[$m['token']];
if (isset($this->urlrefs[$url])) {
$url = $this->urlrefs[$url];
}
Expand Down

0 comments on commit a592335

Please sign in to comment.