/** * Remove from searched stoppers * * @param \Zend\Markup\Token $token * @return void */ protected function _removeFromSearchedStoppers(Markup\Token $token) { $this->_checkTagDeclaration($token->getName()); foreach ($this->_tags[$token->getName()]['stoppers'] as $stopper) { --$this->_searchedStoppers[$stopper]; } }
/** * Check if a tag is a stopper * * @param array $token * @param \Zend\Markup\Token $current * * @return bool */ protected function _isStopper(array $token, Markup\Token $current) { switch ($current->getName()) { case 'h1': case 'h2': case 'h3': case 'h4': case 'h5': case 'h6': case 'list': case 'li': if ($token['type'] == Markup\Token::TYPE_TAG && ($token['name'] == 'break' || $token['name'] == 'p')) { return true; } break; case 'break': return false; break; default: if ($token['type'] == Markup\Token::TYPE_TAG && $token['name'] == $current->getName()) { return true; } break; } return false; }
/** * Execute the token * * @param \Zend\Markup\Token $token * * @return string */ protected function _execute(Token $token) { switch ($token->getType()) { case Token::TYPE_MARKUP: if (!isset($this->_markups[$token->getName()])) { // TODO: apply filters return $this->_markup->filter($token->getContent()) . $this->_render($token) . $this->_markup->filter($token->getStopper()); } $markup = $this->_markups[$token->getName()]; // change the rendering environiment $oldMarkup = $this->_markup; $this->_markup = $markup; $value = $markup($token, $this->_render($token)); // and change the rendering environiment back $this->_markup = $oldMarkup; return $value; break; case Token::TYPE_NONE: default: return $this->_markup->filter($token->getContent()); break; } }
/** * Get the markup name * * @param \Zend\Markup\Token * * @return string */ protected function _getMarkupName(Markup\Token $token) { $name = $token->getName(); if (empty($name)) { return false; } return $this->_resolveMarkupName($name); }