/**
* Callback for:.
*
* > They went in single file, running like hounds on a strong scent,
* and an eager light was in their eyes. Nearly due west the broad
* swath of the marching Orcs tramped its ugly slot; the sweet grass
* of Rohan had been bruised and blackened as they passed.
* >:http://www.mycom.com/tolkien/twotowers.html
*
* @return Texy\HtmlElement|string|FALSE
*/
public function pattern(Texy\BlockParser $parser, array $matches)
{
list(, $mMod, $mPrefix, $mContent) = $matches;
// [1] => .(title)[class]{style}<>
// [2] => spaces |
// [3] => ... / LINK
$texy = $this->texy;
$el = new Texy\HtmlElement('blockquote');
$mod = new Texy\Modifier($mMod);
$mod->decorate($texy, $el);
$content = '';
$spaces = '';
do {
if ($mPrefix === ':') {
$mod->cite = $texy->blockQuoteModule->citeLink($mContent);
$content .= "\n";
} else {
if ($spaces === '') {
$spaces = max(1, strlen($mPrefix));
}
$content .= $mContent . "\n";
}
if (!$parser->next("#^>(?:|(\\ {1,{$spaces}}|:)(.*))()\$#mA", $matches)) {
break;
}
/*
if ($mPrefix === '>') {
$content .= $mPrefix . $mContent . "\n";
} elseif ($mPrefix === ':') {
$mod->cite = $texy->blockQuoteModule->citeLink($mContent);
$content .= "\n";
} else {
if ($spaces === '') $spaces = max(1, strlen($mPrefix));
$content .= $mContent . "\n";
}
if (!$parser->next("#^\\>(?:(\\>|\\ {1,$spaces}|:)(.*))?()$#mA", $matches)) break;
*/
list(, $mPrefix, $mContent) = $matches;
} while (TRUE);
$el->attrs['cite'] = $mod->cite;
$el->parseBlock($texy, $content, $parser->isIndented());
// no content?
if (!$el->count()) {
return FALSE;
}
// event listener
$texy->invokeHandlers('afterBlockquote', [$parser, $el, $mod]);
return $el;
}