/** * Attempt to parse link title (sans quotes) * * @param Cursor $cursor * * @return null|string The string, or null if no match */ public static function parseLinkTitle(Cursor $cursor) { if ($title = $cursor->match(RegexHelper::getInstance()->getLinkTitleRegex())) { // Chop off quotes from title and unescape return RegexHelper::unescape(substr($title, 1, strlen($title) - 2)); } }
public function finalize(ContextInterface $context) { parent::finalize($context); // first line becomes info string $this->info = RegexHelper::unescape(trim($this->strings->first())); if ($this->strings->count() == 1) { $this->finalStringContents = ''; } else { $this->finalStringContents = implode("\n", $this->strings->slice(1)) . "\n"; } }