Skip to content

Commit

Permalink
Comments use 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 cf1bce2 commit 7cc66bb
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/Netcarver/Textile/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -2116,11 +2116,7 @@ protected function replaceMarkers($text, $replacements)
protected function getHTMLComments($text)
{
$text = preg_replace_callback(
"/
\<!-- # start
(.*?) # !content *not* greedy
--> # end
/sx",
"/\<!--(?P<content>.*?)-->/sx",
array(&$this, "fParseHTMLComments"),
$text
);
Expand All @@ -2139,14 +2135,11 @@ protected function getHTMLComments($text)

protected function fParseHTMLComments($m)
{
list(, $content) = $m;
if ($this->restricted) {
$content = $this->shelve($this->rEncodeHTML($content));
} else {
$content = $this->shelve($content);
$m['content'] = $this->rEncodeHTML($m['content']);
}

return "<!--$content-->";
return '<!--'.$this->shelve($m['content']).'-->';
}

/**
Expand Down

0 comments on commit 7cc66bb

Please sign in to comment.