Build an html element
@param string $name
@param array $attributes
@param string $content
@param bool $closeEmptyTag
@return string
350381
public static function buildHtmlElement($name, array $attributes = [], $content = null, $closeEmptyTag = true, array $cssClasses = []): string
    {
        $html = '<' . $name . self::buildAttrs($attributes, $cssClasses);
        if ($content !== null) {
            $html .= '>' . $content . '</' . $name . '>';
        } else {
            $html .= $closeEmptyTag ? ' />' : '>';
        }
        return $html;
    }
961477
private static function buildTag(string $name, $arguments): string
    {
        $tagConf = static::$tagsData[$name];
        $hasValue = (boolean)$tagConf['hasValue'];
        $clear = \iterator_to_array($tagConf['clearAttributes'], true);
        $default = \iterator_to_array($tagConf['defaultAttributes'], true);

        $tagName = $name == 'vartag' ? 'var' : $name;
        $tagValue = static::getTagContent($arguments, $hasValue);
        $attributes = static::getTagAttributes($arguments, $hasValue);
        $attributes = static::clearAttributes($attributes, $clear);
        $attributes = static::setDefaultAttributes($attributes, $default);
        $newLine = '';

        if (\is_array($tagValue)) {
            $tagValue = \implode(static::CRLF, $tagValue);
            $newLine = static::CRLF;
        } elseif (\in_array($tagName, ['body', 'head', 'html'])) {
            $newLine = static::CRLF;
        }

        if ($hasValue === true) {
            return \sprintf(
                '<%s%s>%s%s%s</%s>%s',
                $tagName,
                static::extractAttributes($attributes),
                $newLine,
                \rtrim(\str_replace(static::CRLF.static::CRLF, static::CRLF, $tagValue), static::CRLF),
                $newLine,
                $tagName,
                $newLine
            );
        }

        if (\in_array($tagName, ['iframe'])) {
            return \sprintf('<%s%s></%s>', $tagName, static::extractAttributes($attributes), $tagName);
        }

        return \sprintf('<%s%s/>', $tagName, static::extractAttributes($attributes));
    }
1311334
public function setMeta($name, $content)
    {
        $c = $this->filterXPath('descendant-or-self::meta[@name = \'' . $name . '\']');
        if (count($c) == 0) {
            $node = $this->dom->createElement('meta');
            $node->setAttribute('name', $name);
            $this->getHeadNode()->appendChild($node);
            $c->addNode($node);
        }
        $c->setAttribute('content', $content);
    }
890151
private function blockBegin($name, $attributes)
    {
        $this->transformedTextStack->push('');
        $this->blockTypeStack->push($name);
        $this->blockAttributesStack->push($attributes);
    }
323366
public function full_tag($tag, $content = null, $attributes = null) {
        $content = $this->text_content($content); // First of all, apply transformations
        $this->nullcontent = is_null($content) ? true : false; // Is it null content
        $this->begin_tag($tag, $attributes);
        if (!$this->nullcontent) {
            $this->write($content);
            $this->lastwastext = true;
            $this->end_tag($tag);
        }
    }
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;
	}
229721
public function createEmpty($name, $attr = array())
    {
        $p = clone $this->p_empty;
        $p->__construct($name, $attr);
        return $p;
    }
1230016
public function addMeta ($name, $content, $attributes = array())
		{
			$html = '<meta name="' . $this->sanitize($name) . '" content="' . $this->sanitize($content) . '"';

			foreach ($attributes as $key => $value) {
				$html .= ' ' . $this->sanitize($key) . '="' . $this->sanitize($value) . '"';
			}

			$html .= ' />';

			$this->addHeader($html);
		}
528701
public function build($name = null, array $attributes = [], $callback = null)
    {
        if (!$this->validator->isValid($attributes)) {
            throw new Exception\InvalidAttributesException('Invalid validator class');
        }
        unset($attributes['form']);

        $field = new Fluent([
            'name'       => $name,
            'value'      => isset($attributes['value']) ? $attributes['value'] : '',
            'attributes' => $attributes,
        ]);

        if ($callback instanceof Closure) {
            call_user_func($callback, $field);
        }

        $params  = $this->attributes($field);
        $this->extractor->generateScripts($params);
        $this->memorize($field);
        $hiddens = [
            app('form')->hidden('validator', $attributes['validator'])
        ];

        return view($this->config['view'], ['hiddens' => $hiddens, 'element' => app('form')->button($attributes['title'], $params)])->render();
    }
1151140
public function renderMetaContent( $name, $content = '' )
    {
        $view       = $this->getView();
        $middle     = $this->getMiddleLayoutModel();
        $paragraph  = $middle->getParagraphModel();
        $renderList = $paragraph->findRenderList( $name );

        if ( empty( $renderList ) )
        {
            return $content;
        }

        $meta = reset( $renderList )[1];

        if ( empty( $meta ) )
        {
            return $content;
        }

        $appService     = $view->plugin( 'appService' );
        $serviceManager = $appService();
        $allowOverride  = $serviceManager->getAllowOverride();

        if ( ! $allowOverride )
        {
            $serviceManager->setAllowOverride( true );
        }

        $serviceManager->setService( 'RenderedContent', $meta );

        if ( ! $allowOverride )
        {
            $serviceManager->setAllowOverride( false );
        }

        if ( $meta instanceof LayoutAwareInterface )
        {
            $view->plugin( 'layout' )
                 ->setMiddleLayout(
                     $middle->findMiddleParagraphLayoutById(
                         $meta->getLayoutId()
                     )
                 );
        }

        return $view->render( 'grid/paragraph/render/paragraph', array(
            'paragraphRenderList'  => $renderList,
            'content'              => $content,
        ) );
    }
269258
public static function ul(
        string $content = null, 
        array $attributes = []
    ) : string
    {
        return self::tag("ul", $content, $attributes);
    }
572724
public function append($name, $content = null)
	{
		if (is_array($content)) {
			$first = $this->append($name, $content[0]);
			for ($i = 1; $i < count($content); $i++) {
				$this->append($name, $content[$i]);
			}
			return $first;
		}
		return $this->appendChild($this->newChild($name, $content));
	}
409613
public static function span( array $attributes = array(), $value = null, $close = true )
    {
        return static::tag( 'span', $attributes, $value, $close );
    }
397413
public function tag($name, $content, $attributes = array())
    {
        static $instance;

        $instance = $instance ? clone $instance : new LibBaseTemplateHelperHtmlElement();
        $instance->name = $name;
        $instance->content = $content;
        $instance->attributes = $attributes;

        return $instance;
    }
815543
public function meta($name, String $content = NULL)
    {
        if( ! is_array($name) )
        {
            $this->outputElement .= $this->_singleMeta($name, $content);
        }
        else
        {
            $metas = NULL;

            foreach( $name as $key => $val )
            {
                $metas .= $this->_singleMeta($key, $val);
            }

            $this->outputElement .= $metas;
        }

        return $this;
    }
1093739
public function openTag($name, $attributes=null) {
        if ($attributes) {
          $initial = $name;
          $name = self::open($initial);
          $name .= self::getAttributesCollection($attributes);
          $name .= ">";

          return $name;
        } 

      return self::fullOpen($name);
    }
125693
public function tagEmpty($tag, $content)
    {
        $name     = $tag['name'];
        $name     = $this->autoBuildVar($name);
        $parseStr = '<?php if(empty(' . $name . ') || ((' . $name . ' instanceof \think\Collection || ' . $name . ' instanceof \think\Paginator ) && ' . $name . '->isEmpty())): ?>' . $content . '<?php endif; ?>';

        return $parseStr;
    }