/** * @param array $matches A set of results of the `transform` function * @return string */ protected function _email_callback($matches) { $address = $matches[1]; Kernel::addConfig('urls', $address); $block = Kernel::get('OutputFormatBag')->buildTag('link', $address, array('email' => $address)); return parent::hashPart($block); }
/** * Process ATX-style headers * * @param array $matches The results from the `transform()` function * @return string */ protected function _atx_callback($matches) { $level = strlen($matches[1]) + $this->_getRebasedHeaderLevel(); $domid = !empty($matches[3]) ? $matches[3] : Helper::header2Label($matches[2]); $domid = Kernel::get('DomId')->set($domid); $title = Lexer::runGamut('span_gamut', $matches[2]); Kernel::addConfig('menu', array('level' => $level, 'text' => parent::unhash($title)), $domid); $block = Kernel::get('OutputFormatBag')->buildTag('title', $title, array('level' => $level, 'id' => $domid)); $this->_setContentTitle($title); return "\n" . parent::hashBlock($block) . "\n\n"; }
/** * Add each link reference to `$urls` and `$titles` tables with index `$link_id` * * @param array $matches A set of results of the `transform()` function * @return string Empty string */ protected function _strip_callback($matches) { $link_id = strtolower($matches[1]); $url = $matches[2] == '' ? $matches[3] : $matches[2]; Kernel::addConfig('urls', array($link_id => $url)); Kernel::addConfig('titles', array($link_id => $matches[4])); Kernel::addConfig('attributes', array($link_id => $matches[5])); return ''; }
/** * Build the footnote and strip it from content * * @param array $matches Results from the `transform()` function * @return string */ protected function _strip_callback($matches) { if (0 !== preg_match('/^(<p>)?glossary:/i', $matches[2])) { Kernel::addConfig('glossaries', array(Kernel::getConfig('glossarynote_id_prefix') . $matches[1] => Lexer::runGamut(GamutLoader::TOOL_ALIAS . ':Outdent', $matches[2]))); } elseif (0 !== preg_match('/^\\#(.*)?/i', $matches[1])) { Kernel::addConfig('bibliographies', array(Kernel::getConfig('bibliographynote_id_prefix') . substr($matches[1], 1) => Lexer::runGamut(GamutLoader::TOOL_ALIAS . ':Outdent', $matches[2]))); } else { Kernel::addConfig('footnotes', array(Kernel::getConfig('footnote_id_prefix') . $matches[1] => Lexer::runGamut(GamutLoader::TOOL_ALIAS . ':Outdent', $matches[2]))); } return ''; }
/** * Strips abbreviations from text, stores titles in hash references. * * @param array $matches Results from the `strip()` function * @return string The replacement text */ protected function _strip_callback($matches) { Kernel::addConfig('abbr_word_re', (Kernel::getConfig('abbr_word_re') ? '|' : '') . preg_quote($matches[1])); Kernel::addConfig('abbr_desciptions', array($matches[1] => trim($matches[2]))); return ''; }