Exemplo n.º 1
0
 function preParse($compiller)
 {
     if (!$this->has('name')) {
         throw new lmbMacroException('Tag {{mailpart}}, required attribute "name"');
     }
     parent::preParse($compiller);
 }
Exemplo n.º 2
0
 function preParse($compiller)
 {
     if (!$this->has('text')) {
         throw new lmbMacroException('tag {{i18n}} required attribute "text"');
     }
     parent::preParse($compiller);
 }
Exemplo n.º 3
0
 function preParse($compiler)
 {
     if (!$this->has('using') && $this->has('for')) {
         $this->set('using', $this->get('for'));
     }
     return parent::preParse($compiler);
 }
Exemplo n.º 4
0
 function preParse($compiler)
 {
     if (!$this->has('var') && !$this->has('expr')) {
         throw new lmbMacroException("'var'( alias 'expr') attribute is required for 'elseif' tag");
     }
     parent::preParse($compiler);
 }
Exemplo n.º 5
0
 function preParse($compiler)
 {
     parent::preParse($compiler);
     if ($slot_node = $this->parent->findUpChild($this->get('slot'))) {
         $this->is_dynamic = false;
     } else {
         $this->is_dynamic = true;
     }
     if (!$this->is_dynamic) {
         $tree_builder = $compiler->getTreeBuilder();
         $tree_builder->pushCursor($slot_node, $this->location);
     }
 }
Exemplo n.º 6
0
 function preParse($compiler)
 {
     if ($this->has('in')) {
         $this->set('into', $this->get('in'));
     }
     if ($this->has('with')) {
         $att = $this->getAttributeObject('with');
         $att->setName('file');
         $this->add($att);
     }
     parent::preParse($compiler);
     if ($this->isDynamic('file')) {
         $this->is_dynamic = true;
     }
     if (!$this->is_dynamic) {
         $file = $this->get('file');
         $compiler->parseTemplate($file, $this);
         //if there's no 'into' attribute we consider that {{insert:into}} tags used instead
         if ($into = $this->get('into')) {
             $tree_builder = $compiler->getTreeBuilder();
             $this->_insert($this, $tree_builder, $into);
         }
     }
 }
Exemplo n.º 7
0
 function testRestrictSelfNesting()
 {
     $tag_info = new lmbMacroTagInfo('CompilerTag', 'whatever');
     $tag_info->setRestrictSelfNesting(true);
     $node = new lmbMacroTag(new lmbMacroSourceLocation('my_file', 13), 'whatever', $tag_info);
     $parent = new lmbMacroTag(new lmbMacroSourceLocation('my_file', 10), 'whatEver', $tag_info);
     $node->setParent($parent);
     try {
         $node->preParse(new MockMacroCompiler());
         $this->assertTrue(false);
     } catch (lmbMacroException $e) {
         $this->assertPattern('/Tag cannot be nested within the same tag/', $e->getMessage());
         $this->assertEqual($e->getParam('same_tag_file'), 'my_file');
         $this->assertEqual($e->getParam('same_tag_line'), 10);
     }
 }
Exemplo n.º 8
0
 function preParse($compiler)
 {
     $list = $this->findParentByClass('lmbMacroListTag');
     $list->countSource();
     return parent::preParse($compiler);
 }