Add element at an existing Markup

@param  Tag|string $tag
@param  array      $attributes

@return Tag
2925
public function addElement($tag, array $attributes = [])
    {
        if ($tag instanceof self) {
            $htmlTag      = $tag;
            $htmlTag->top = $this->top;
            $htmlTag->attrs($attributes);
            $this->elements->add($htmlTag);

            return $htmlTag;
        }

        return self::make(
            $tag,
            $attributes,
            $this->hasParent() ? $this->parent : $this
        );
    }
434969
protected function insertTag(Tag $tag)
	{
		if (!$this->tagStackIsSorted)
		{
			$this->tagStack[] = $tag;
		}
		else
		{
			// Scan the stack and copy every tag to the next slot until we find the correct index
			$i = count($this->tagStack);
			while ($i > 0 && self::compareTags($this->tagStack[$i - 1], $tag) > 0)
			{
				$this->tagStack[$i] = $this->tagStack[$i - 1];
				--$i;
			}
			$this->tagStack[$i] = $tag;
		}
	}
757334
public function addTag(Tag $tag)
    {
        $tag->setBlog($this);
        $this->tags->add($tag);

        return $tag;
    }
99011
public static function addTags(array $tags)
    {
        if (count($tags) === 0)
            return;

        $found = Tag::whereIn('tag', $tags)->pluck('tag')->all();

        foreach (array_diff($tags, $found) as $tag) {
            if (empty(trim($tag)) || strlen($tag) < 3)
                continue;

            try {
                $model = new Tag;
                $model->tag = trim($tag);
                $model->save();
            } catch (\Illuminate\Database\QueryException $e) {
                $context = [];
                $context['file'] = $e->getFile() ?: '';
                $context['line'] = $e->getLine() ?: '';
                $context['code'] = $e->getCode() ?: '';

                logger()->warning($e->getMessage(), $context);
            }
        }
    }
1338571
function _tag_open( &$parser, $tag, $attributes ) {
		$this->currentElement = strtoupper( $tag );

		switch( $this->currentElement ) {
			case 'DROP':
				$this->drop();
				break;
			case 'CLUSTERED':
			case 'BITMAP':
			case 'UNIQUE':
			case 'FULLTEXT':
			case 'HASH':
				// Add index Option
				$this->addIndexOpt( $this->currentElement );
				break;
			default:
				// print_r( array( $tag, $attributes ) );
		}
	}
832601
public function addMeta($tag, $value, array $attributes = []){
		$value = $this->h($value);
		if( false !== strpos($tag, ':') ){
			$tags = explode(':', $tag);
			$node = $this->dom->metadata->addChild($tags[1], $value, Schemas::getUri($tags[0]));
		}else{
			$node = $this->dom->metadata->addChild($tag, $value);
		}
		foreach( $attributes as $key => $val ){
			$node[$key] = $this->h($val);
		}
	}
987677
public static function create(string $tag, string $content = null, array $attributes = null,
        bool $selfClosing = false, bool $v5 = true): string
    {
        if ($attributes != null) {
            $tmp = [];
            foreach ($attributes as $name => $value) {
                if ($value === null) { // eg: ['a' => 1, 'b' => null, ...]
                    $tmp[] = $name;
                } elseif (is_int($name)) { // eg: ['a' => 1, 'b', ...]
                    $tmp[] = $value;
                } else { // eg: ['a' => 1, 'b' => 2, ...]
                    $tmp[] = sprintf('%s="%s"', $name, strtr((string) $value, ['"' => '&quot;']));
                }
            }
            $attributes = ' '. join(' ', $tmp);
        }

        return $selfClosing || in_array($tag, self::$selfClosingTags)
            ? sprintf('<%s%s%s>', $tag, $attributes, $v5 ? '' : ' /')
            : sprintf('<%s%s>%s</%s>', $tag, $attributes, $content, $tag);
    }
369660
public function setTag(array $tag)
    {
        $this->validateInput(
            $tag,
            $this->validator,
            'validateTag',
            $this->exception,
            'Provided tag array is not a valid value.'
        );

        foreach ($tag as $tagName) {
            self::$xml['tag'] .= '<video:tag>'.$tagName.'</video:tag>';
        }

        return $this;
    }
514218
protected function writeTag($tagName, array $attributes, $content)
	{
		$xml = '<' . $tagName;
		foreach ($attributes as $attrName => $attrValue)
		{
			$xml .= ' ' . $attrName . '="' . htmlspecialchars($attrValue) . '"';
		}
		if ($content === '')
		{
			$xml .= '/>';
		}
		else
		{
			$xml .= '>' . $content . '</' . $tagName . '>';
		}

		return $xml;
	}
370680
def add_tag(
            self,
            tag):
        

        if tag.replace("@", "") in self.tags:
            return

        self.refresh
        oldContent = self.to_string(indentLevel=1)
        self.tags += [tag.replace("@", "")]
        newContent = self.to_string(indentLevel=1)

        # ADD DIRECTLY TO CONTENT IF THE PROJECT IS BEING ADDED SPECIFICALLY TO
        # THIS OBJECT
        self.parent._update_document_tree(
            oldContent=oldContent,
            newContent=newContent
        )

        self.refresh
        return None
356770
public function addTag($tag, $publicIds = array(), $options = array())
    {
        return $this->getUploader()->add_tag($tag, $publicIds, $options);
    }
34043
public static function tag($tag, $text = '', array $attributes = NULL)
    {
        $autoClose = array('input', 'br', 'hr', 'img', 'col', 'area', 'base', 'link', 'meta', 'frame', 'param');
        return "<$tag" . self::attributes($attributes) . (in_array($tag, $autoClose) ? ' />' : ">$text</$tag>");
    }
1253555
public function createElement($tag, $attributes = null)
    {
        $node = parent::createElement($tag);
        $text = false;
        if (is_string($attributes)) {
            $node->setAttribute('class', $attributes);
        } else {
            if (is_array($attributes)) {
                foreach ($attributes as $key => $value) {
                    if ($key == 'text') {
                        $node->appendChild($this->createTextNode($value));
                        $text = true;
                    } else {
                        if (!is_null($value)) {
                            $node->setAttribute($key, $value);
                        }
                    }
                }
            }
        }
        if (!$text && !in_array($tag, ['img', 'br', 'input'])) {
            $node->appendChild($this->createTextNode(''));
        }
        return $node;
    }
27908
public function append(Tag $tag) : Tag
    {
        if ($this->isVoid) {
            throw new \LogicException('Void elements cannot have any contents.');
        }

        $this->content .= $tag->render();

        return $this;
    }
290378
public function createElement(array $attributes)
    {
        $meta = $this->ownerDocument->createElement('meta');

        $name = null;
        foreach ($attributes as $key => $value) {
            $meta->setAttribute($key, $value);
        }

        $this[] = $meta;

        return $meta;
    }
814090
def add_tag(tag)
      if @counters[:attributes][:tag] >= Mailgun::Chains::MAX_TAGS
        fail Mailgun::ParameterError, 'Too many tags added to message.', tag
      end
      set_multi_complex('o:tag', tag)
      @counters[:attributes][:tag] += 1
    end
1149040
public function addTag($tag)
    {
        if (!\in_array(ExtTagInterface::class, \class_implements($tag), true)) {
            throw new Exception(\sprintf('The class %s must be implement interface %s', $tag, ExtTagInterface::class));
        }

        $this->tags[] = $tag;
        return $this;
    }