Handles BBCode closing tag
@param string $tag
@return bool
499181
private function tag_close($tag)
	{
		if(!$this->current_tag instanceof Node_Container_Document
			&& $tag !== $this->current_tag->tag())
		{
			$closing_tags = $this->bbcodes[$this->current_tag->tag()]->closing_tags();

			if(in_array($tag, $closing_tags) || in_array('/' . $tag, $closing_tags))
				$this->current_tag = $this->current_tag->parent();
		}

		if($this->current_tag instanceof Node_Container_Document)
			return false;
		else if($tag !== $this->current_tag->tag())
		{
			// check if this is a tag inside another tag like
			// [tag1] [tag2] [/tag1] [/tag2]
			$node = $this->current_tag->find_parent_by_tag($tag);

			if($node !== null)
			{
				$this->current_tag = $node->parent();

				while(($node = $node->last_tag_node()) !== null)
				{
					$new_node = new Node_Container_Tag($node->tag(), $node->attributes());
					$this->current_tag->add_child($new_node);
					$this->current_tag = $new_node;
				}
			}
			else
				return false;
		}
		else
			$this->current_tag = $this->current_tag->parent();

		return true;
	}
1279048
def _handle_tag_open_close(self):
        """"""
        self._emit(tokens.TagOpenClose())
        self._push(contexts.TAG_CLOSE)
        self._head += 1
304548
private function close_bbcodes($open_bbcodes)
	{
		foreach ($open_bbcodes as $bbcode_tag)
		{
			$this->trimmed_message .= '[/' . $bbcode_tag . ':' . $this->bbcode_uid . ']';
		}
	}
855748
public function removeSpecialCaseTag($tag)
    {
        if (($key = array_search($tag, $this->specialCaseTags)) !== false) {
            unset($this->specialCaseTags[$key]);

            $opening = $this->getOpeningTag($tag);
            $closing = $this->getClosingTag($tag);

            if (($key = array_search($opening, $this->specialCaseOpeningTags)) !== false) {
                unset($this->specialCaseOpeningTags[$key]);
            }
            if (($key = array_search($closing, $this->specialCaseClosingTags)) !== false) {
                unset($this->specialCaseClosingTags[$key]);
            }
        }

        return $this;
    }
682367
public function end_tag($tag) {
        // TODO: check the tag name is valid

        if ($this->level == 0) { // Nothing to end, already at level 0
            throw new xml_writer_exception('xml_writer_end_tag_no_match');
        }

        $pre = $this->lastwastext ? '' : "\n" . str_repeat(' ', ($this->level - 1) * 2); // Indent
        $tag = $this->casefolding ? strtoupper($tag) : $tag; // Follow casefolding

        $lastopentag = array_pop($this->opentags);

        if ($tag != $lastopentag) {
            $a = new stdclass();
            $a->lastopen = $lastopentag;
            $a->tag = $tag;
            throw new xml_writer_exception('xml_writer_end_tag_no_match', $a);
        }

        // Send to xml_output
        $this->write($pre . '</' . $tag . '>');

        $this->level--;
        $this->lastwastext = false;
    }
786548
public function hasSingleTagInsideElement($tag)
    {
        // There should be exactly 1 element child with given tag
        if (count($children = $this->getChildren(true)) !== 1 || $children[0]->nodeName !== $tag) {
            return false;
        }

        // And there should be no text nodes with real content
        return array_reduce($children, function ($carry, $child) {
            if (!$carry === false) {
                return false;
            }

            /* @var DOMNode $child */
            return !($child->nodeType === XML_TEXT_NODE && !preg_match('/\S$/', $child->getTextContent()));
        });
    }
66184
public function checkTag(Tag $tag)
	{
		if (isset($tag->template) && !($tag->template instanceof UnsafeTemplate))
		{
			$template = (string) $tag->template;
			$this->checkTemplate($template, $tag);
		}
	}
779598
protected function endTag() {
        if ($this->scanner->current() != '/') {
            return false;
        }
        $tok = $this->scanner->next();

        // a-zA-Z -> tagname
        // > -> parse error
        // EOF -> parse error
        // -> parse error
        if (!ctype_alpha($tok)) {
            $this->parseError("Expected tag name, got '%s'", $tok);
            if ($tok == "\0" || $tok === false) {
                return false;
            }
            return $this->bogusComment('</');
        }

        $name = strtolower($this->scanner->charsUntil("\n\f \t>"));
        // Trash whitespace.
        $this->scanner->whitespace();

        if ($this->scanner->current() != '>') {
            $this->parseError("Expected >, got '%s'", $this->scanner->current());
            // We just trash stuff until we get to the next tag close.
            $this->scanner->charsUntil('>');
        }

        $this->events->endTag($name);
        $this->scanner->next();
        return true;
    }
876891
public function isVoidElement($tag = null)
    {
        if (null === $tag) {
            $tag = $this->getTag();
        }

        return in_array($tag, $this->voidElements);
    }
857184
protected function parseBBCode()
	{
		$this->parseBBCodeSuffix();

		// Test whether this is an end tag
		if ($this->text[$this->startPos + 1] === '/')
		{
			// Test whether the tag is properly closed and whether this tag has an identifier.
			// We skip end tags that carry an identifier because they're automatically added
			// when their start tag is processed
			if (substr($this->text, $this->pos, 1) === ']' && $this->bbcodeSuffix === '')
			{
				++$this->pos;
				$this->addBBCodeEndTag();
			}

			return;
		}

		// Parse attributes
		$this->parseAttributes();

		// Test whether the tag is properly closed
		if (substr($this->text, $this->pos, 1) === ']')
		{
			++$this->pos;
		}
		else
		{
			// Test whether this is a self-closing tag
			if (substr($this->text, $this->pos, 2) === '/]')
			{
				$this->pos += 2;
				$this->addBBCodeSelfClosingTag();
			}

			return;
		}

		// Record the names of attributes that need the content of this tag
		$contentAttributes = [];
		if (isset($this->bbcodeConfig['contentAttributes']))
		{
			foreach ($this->bbcodeConfig['contentAttributes'] as $attrName)
			{
				if (!isset($this->attributes[$attrName]))
				{
					$contentAttributes[] = $attrName;
				}
			}
		}

		// Look ahead and parse the end tag that matches this tag, if applicable
		$requireEndTag = ($this->bbcodeSuffix || !empty($this->bbcodeConfig['forceLookahead']));
		$endTag = ($requireEndTag || !empty($contentAttributes)) ? $this->captureEndTag() : null;
		if (isset($endTag))
		{
			foreach ($contentAttributes as $attrName)
			{
				$this->attributes[$attrName] = substr($this->text, $this->pos, $endTag->getPos() - $this->pos);
			}
		}
		elseif ($requireEndTag)
		{
			return;
		}

		// Create this start tag
		$tag = $this->addBBCodeStartTag();

		// If an end tag was created, pair it with this start tag
		if (isset($endTag))
		{
			$tag->pairWith($endTag);
		}
	}
156813
public function removeByTag($tag)
    {
        $tags = (array) $tag;

        if (0 == count($tags)) {
            return false;
        }

        try {
            $this->_repository
                    ->createQueryBuilder('c')
                    ->delete()
                    ->where('c._tag IN (:tags)')
                    ->setParameters(array('tags' => $this->getContextualTags($tags)))
                    ->getQuery()
                    ->execute();
            $this->resetCacheEntity();
        } catch (\Exception $e) {
            $this->log('warning', sprintf('Enable to remove cache for tags (%s) : %s', implode(',', $tags), $e->getMessage()));

            return false;
        }

        return true;
    }
1356443
def handle_endtag(self, tag):
        
        self.log.debug( u'Encountered an end tag : {0}'.format(tag) )
        if tag in self.sanitizelist:
            self.level -= 1
            return
        if tag in self.unclosedTags:
            return
        if self.isNotPurify or tag in self.whitelist_keys:
            self.data.append(u'</%s>' % tag)
448711
public function onReplaceInsertTags($tag)
    {
        $elements = explode('::', $tag);
        $key = strtolower($elements[0]);
        if (in_array($key, $this->supportedTags, true)) {
            return $this->replaceThemeInsertTag($elements[1], $elements[2]);
        }
        return false;
    }
291790
public function flush($tag)
    {
        if ($this->isTaggable()) {
            return Cache::tags($tag)->flush();
        }

        return Cache::flush();
    }
381794
private static function checkExp($tag)
    {
        return (false !== strpos($tag, ',')) || (false !== strpos($tag, '-')) || (false !== strpos($tag, '/'));
    }
701693
@Override
  protected void visitHtmlCloseTagNode(HtmlCloseTagNode node) {
    // This case occurs in the case where we encounter the end of a keyed element. If the open tag
    // mapped to this close tag contains a key node, pop the keyCounterStack to return
    // to the state before entering the keyed node.
    if (node.getTaggedPairs().size() == 1) {
      HtmlOpenTagNode openTag = (HtmlOpenTagNode) node.getTaggedPairs().get(0);
      if (openTag.getKeyNode() != null) {
        keyCounterStack.pop();
        getJsCodeBuilder().append(INCREMENTAL_DOM_POP_MANUAL_KEY.call());
      }
    }

    if (!node.getTagName().isDefinitelyVoid()) {
      emitClose(getTagNameCodeChunk(node.getTagName()));
    }
  }
972640
public function onReplaceInsertTags(string $tag)
    {
        $elements = explode('::', $tag);
        $key = strtolower($elements[0]);
        $attributes = \array_slice($elements, 1);

        if (\in_array($key, $this->supportedTags)) {
            return $this->replaceSupportedTags($key, $attributes);
        }

        return false;
    }