/**
  * Inject the composed parser into the retrieved renderer instance
  *
  * @param  Renderer\AbstractRenderer $instance
  * @return void
  */
 public function injectParser($instance)
 {
     $parser = $this->getParser();
     if ($parser === null) {
         return;
     }
     $instance->setParser($parser);
 }
Example #2
0
 /**
  * Constructor
  *
  * @param array|\Zend\Config\Config $options
  *
  * @todo make constructor compliant with new configuration standards
  *
  * @return void
  */
 public function __construct($options = array())
 {
     if ($options instanceof Config) {
         $options = $options->toArray();
     }
     if (isset($options['markups'])) {
         if (!isset($options['markups']['Zend_Markup_Root'])) {
             $options['markups'] = array('Zend_Markup_Root' => new RootMarkup());
         }
     }
     parent::__construct($options);
 }
Example #3
0
    /**
     * Set the renderer instance
     *
     * @param \Zend\Markup\Renderer\AbstractRenderer $renderer
     *
     * @return \Zend\Markup\Renderer\Markup\AbstractMarkup
     */
    public function setRenderer(AbstractRenderer $renderer)
    {
        $this->_renderer = $renderer;

        $this->setEncoding($renderer->getEncoding());

        return $this;
    }
Example #4
0
 /**
  * Execute a single replace token
  *
  * @param  \Zend\Markup\Token $token
  * @param  array $markup
  * @return string
  */
 protected function _executeSingleReplace(Token $token, $markup)
 {
     if (isset($markup['tag'])) {
         if (!isset($markup['attributes'])) {
             $markup['attributes'] = array();
         }
         $attrs = self::renderAttributes($token, $markup['attributes']);
         return "<{$markup['tag']}{$attrs} />";
     }
     return parent::_executeSingleReplace($token, $markup);
 }