<?php

namespace Kachkaev\JstmplBundle\Twig;

class JstmplNode extends \Twig_Node
{
    public function __construct($id, \Twig_Node $body, $lineno)
    {
        parent::__construct(array('body' => $body), array('id' => $id), $lineno);
    }

    public function compile(\Twig_Compiler $compiler)
    {
        $compiler->addDebugInfo($this);
        $compiler->write("	echo \"<script id=\\\"".$this->getAttribute('id')."\\\" type=\\\"text/html\\\">\";\n");
        $compiler->subcompile($this->getNode('body'));
        $compiler->write("	echo \"</script>\\n\\n\";\n");
    }
}