Shortcode handler for [equation].

@param array $atts Shortcode attributes.
@param string $content Shortcode content.
@param string $shortcode Shortcode name.

@return string
499455
public function equationShortCodeHandler( $atts, $content, $shortcode ) {
		if ( ! $content ) {
			return '';
		}
		$atts = shortcode_atts(
			[
				'size' => 0,
				'color' => false,
				'background' => false,
			], $atts
		);

		return do_shortcode_by_tags(
			sprintf(
				'<p>[latex%1$s]%2$s[/latex]' . "</p>\n",
				( $atts['size'] !== 0 )
				? sprintf(
					' size="%1$s" color="%2$s" background="%3$s"',
					$atts['size'],
					$atts['color'],
					$atts['background']
				)
				: sprintf(
					' color="%1$s" background="%2$s"',
					$atts['color'],
					$atts['background']
				),
				$content
			),
			[ 'latex' ]
		);
	}
1319025
public function doShortcode(string $content, $tags = [], bool $deep = false): string
    {
        $tags = $this->preProcessTags($tags);
        $handler = function (string $tag, ?string $content = null, array $atts = []) {
            $shortcode = $this[$tag];

            if ($shortcode instanceof AttributeInterface) {
                $atts = array_merge($shortcode->getAttributes(), $atts);

                return $shortcode->handle($content, $atts);
            }

            return $shortcode->handle($content);
        };

        $result = (string) $this->parser->parseShortcode($content, $tags, $handler);

        if ($deep && $this->hasShortcode($result, $tags)) {
            return $this->doShortcode($result, $tags, $deep);
        }

        return $result;
    }
99194
public static function coreHTMLElement($element, $content, array $attrs = []) {

        $template = "<%element%%attributes%>%innerHTML%</%element%>";

        $attributes = trim(StringHelper::parseArray($attrs));
        if (0 < strlen($attributes)) {
            $attributes = " " . $attributes;
        }

        $innerHTML = null !== $content ? trim($content, " ") : "";

        return StringHelper::replace($template, ["%element%", "%attributes%", "%innerHTML%"], [trim($element), $attributes, $innerHTML]);
    }
619621
public function render($content, array $attribs = [])
    {
        if (isset($attribs['tagName'])) {
            $tagName = $attribs['tagName'];
            unset($attribs['tagName']);
        } else {
            $tagName = $this->getTagName();
        }

        if (!$tagName) {
            return $this->renderContent($content);
        }

        if (!$content && !$this->closeTag) {
            $openTag = trim($this->getOpenTag($tagName, $attribs));
            return substr_replace($openTag, $this->getClosingBracket(), -1);
        }

        return $this->getOpenTag($tagName, $attribs) .
            $this->renderContent($content) .
            $this->getCloseTag($tagName);
    }
625800
def shorthand_attributes(atts = {})
      while (key = accept :shorthand)
        key = Settings::SHORTHAND[key.to_sym]

        # Check whether the value is escaped or unescaped
        escaped = accept(:unescaped_value) ? false : true

        # Get the attribute value and process it
        if (value = accept(:shorthand_node))
          value = [:expression, value.inspect, { escaped: escaped }]
        elsif (value = accept(:exp_string))
          value = [:expression, value, { escaped: escaped }]
        elsif (value = paranthesis)
          value = [:expression, value, { escaped: escaped }]
        else
          Logger.error :parse, @code, @i, @j, :shorthand
        end

        # IDs are unique, the rest of the attributes turn into arrays in
        # order to allow multiple values or identifiers
        add_attribute(atts, key, value)
      end

      atts
    end
429677
public function doShortcode(string $content, bool $deep = false): string
    {
        if (!($this->isBound())) {
            throw RegisterException::missing($this->name);
        }

        return $this->manager->doShortcode($content, $this->getContext(), $deep);
    }
497205
function shortCode( $_atts, $latex ) {
		$atts = shortcode_atts( array(
		    'size' => 0,
		    'color' => false,
		    'background' => false,
			), $_atts );

		$latex = preg_replace( array( '#<br\s*/?>#i', '#</?p>#i' ), ' ', $latex );

		$latex = str_replace(
			array( '&lt;', '&gt;', '&quot;', '&#8220;', '&#8221;', '&#039;', '&#8125;', '&#8127;', '&#8217;', '&#038;', '&amp;', "\n", "\r", "\xa0", '&#8211;' ),
			array( '<',    '>',    '"',      '``',       "''",     "'",      "'",       "'",       "'",       '&',      '&',     ' ',  ' ',  ' ',    '-' ),
			$latex
		);

		$latex_object = $this->latex( $latex, $atts['background'], $atts['color'], $atts['size'] );

		$url = esc_url( $latex_object->url );
		$alt = esc_attr( is_wp_error( $latex_object->error ) ? $latex_object->error->get_error_message() . ": $latex_object->latex" : $latex_object->latex  );

		return "<img src='$url' alt='$alt' title='$alt' class='latex' />";
	}
715568
public static function shortcodeToEntities($content) {
        $replacements = self::getShortcodeEntities();
        return str_replace(array_keys($replacements), $replacements, $content);
    }
379938
public static function addPhpTag($content = '', $first = null, $last = null)
    {
        $content = '<?php' . "\n" . $content;
        if ($first && $first instanceof Stmt\InlineHTML) {
            $content = preg_replace('/^<\\?php\\s+\\?>\\n?/', '', $content);
        }
        if ($last && $last instanceof Stmt\InlineHTML) {
            $content = preg_replace('/<\\?php$/', '', rtrim($content));
        }
        return $content;
    }
1297420
public function _shortcode( $attributes ) {
		if ( ! isset( $attributes['post_id'] ) ) {
			return;
		}

		$title = wp_strip_all_tags( get_the_title( $attributes['post_id'] ) . ' - ' . get_bloginfo( 'name' ) );

		$attributes = shortcode_atts(
			[
				'type'     => 'balloon',
				'title'    => apply_filters( 'inc2734_wp_share_buttons_shared_title', $title, 'twitter' ),
				'post_id'  => '',
				'hashtags' => apply_filters( 'inc2734_wp_share_buttons_shared_hashtags', '', 'twitter' ),
			],
			$attributes
		);

		if ( 'official' === $attributes['type'] ) {
			$file = 'official';
		} else {
			$file = 'twitter';
		}

		if ( function_exists( 'scc_get_share_twitter' ) ) {
			$has_cache  = true;
			$expiration = null;
			$count      = scc_get_share_twitter();
		} else {
			$count_cache = new Count_Cache( $attributes['post_id'], 'twitter' );
			$has_cache   = $count_cache->is_enabled();
			$expiration  = $count_cache->get_cache_expiration();
			$cache       = $count_cache->get();
			$count       = ( ! is_null( $cache ) ) ? $cache : '-';
		}

		return $this->render(
			'twitter/' . $file,
			[
				'type'       => $attributes['type'],
				'title'      => $attributes['title'],
				'post_id'    => $attributes['post_id'],
				'hashtags'   => $attributes['hashtags'],
				'has_cache'  => $has_cache,
				'expiration' => $expiration,
				'count'      => $count,
			]
		);
	}
857878
protected function checkForErrors( array $atts )
	{
		$args = $this->args;

		if( !array_key_exists( $atts['name'], $args['errors'] )) {
			$this->args['errors'] = ''; // set to an empty string
			return;
		}

		$field_errors = $args['errors'][ $atts['name'] ];

		$errors = array_reduce( $field_errors['errors'], function( $carry, $error ) {
			return $carry . sprintf( '<span>%s</span> ', $error );
		});

		$this->args['errors'] = sprintf( '<span class="glsr-field-errors">%s</span>', $errors );
	}
168794
public static function tr(
        string $content = null, 
        array $attributes = []
    ) : string
    {
        return self::tag("tr", $content, $attributes);
    }
1293430
public function getShortContent($maxlength = 50, $attr = 'content')
    {
        $content = $this->{$attr};
        if (strlen($content) > $maxlength) {
            return substr($content, 0, $maxlength).'...';
        }

        return $content;
    }
996069
public function renderLayout($content, $layout = null)
    {
        $html = parent::renderLayout($content, $layout);

        return $this->shortcodes($html);
    }
880882
public static function encodeUnicode($content)
    {
        $content = self::shortcodeToUnicode($content);
        $content = self::entitiesToUnicode($content);

        return $content;
    }
438962
public static function script(
        string $content, 
        array $attributes = ["type" => "text/javascript"],
        bool $addCdataTag = true
    ) : string
    {
        if ($addCdataTag) {
            $content = "\n//<![CDATA[\n" . $content ."\n//]]>\n";
        }
        return self::tag("script", $content, $attributes);
    }
480375
public static function process($content)
    {
        $content = self::parseVariables($content);

        $handlers = new HandlerContainer();

        foreach (self::$shortcodes as $shortcode_name => $class) {
            $handlers->add($shortcode_name, function (ShortcodeInterface $s) use ($class) {
                $shortcode             = new $class;
                $shortcode->attributes = array_merge($shortcode->attributes, $s->getParameters());
                $shortcode->content    = $s->getContent();

                return $shortcode->output();
            });
        }

        $handlers->setDefault(function (ShortcodeInterface $s) {
            $shortcode_name = snake_case($s->getName());

            $params  = $s->getParameters();
            $content = $s->getContent();

            if (function_exists("giga_shortcode_{$shortcode_name}")) {
                return call_user_func_array("giga_shortcode_{$shortcode_name}", [$params, $content]);
            }

            $lead = Conversation::get('lead');

            return $lead->data($shortcode_name);
        });

        $processor = new Processor(new RegularParser(), $handlers);

        $content = $processor->process($content);

        $output = json_decode($content, true);

        if (json_last_error() === JSON_ERROR_NONE) {
            return $output;
        }

        return $content;
    }