public function enterTag(Tag $tag)
 {
     if ($tag->hasChilds() || $tag->hasContent()) {
         return;
     }
     if (in_array($tag->getTagName(), $this->autocloseTags)) {
         $tag->setFlag(Tag::FLAG_SELF_CLOSE);
     }
 }
Esempio n. 2
0
 public function enterTag(Tag $node)
 {
     $name = $node->getTagName();
     $flags = $node->getFlags();
     if ($flags & Tag::FLAG_REMOVE_INNER_WHITESPACES) {
         $name .= '<';
     }
     if ($flags & Tag::FLAG_REMOVE_OUTER_WHITESPACES) {
         $name .= '>';
     }
     if ($flags & Tag::FLAG_SELF_CLOSE) {
         $name .= '/';
     }
     $this->write('tag(' . $name, true, false)->indent();
     if ($node->hasContent()) {
         $this->raw(' ');
         $node->getContent()->accept($this);
     }
     if ($node->hasAttributes() || $node->hasChilds()) {
         $this->raw("\n");
     }
 }