Performs specific body text formatting

@param   string  The body text
@param   array   The legacy document

@return  value
168594
protected function formatBody($value, array $doc)
    {
        $value = $this->convertEncoding($value);

        // Replace html titles
        $value = mb_ereg_replace('<h[1-5].*?>(.*?)</h[1-5]>', "<h3>\\1</h3>", $value);

        // Strip jump tags
        $value = str_replace('[jump]', '<!-- [jump] -->', $value);

        // Fix spaces in <a> elements
        $value = mb_ereg_replace('<a\shref="\s+', '<a href="', $value, 'i');

        // Remove empty p tags
        $value = mb_ereg_replace('<p[^>]*>[\s|&nbsp;]*<\/p>', '', $value, 'ims');

        // Replace '--' with em dash
        $value = $this->replaceEmDash($value);

        // Handle oembeds
        $value = $this->transformOEmbeds($value);

        // Trim
        return trim($value);
    }
994486
protected function __applyFormatting($data, $validate = false, &$errors = null)
    {
        $result = '';

        if ($this->get('formatter')) {
            $formatter = TextformatterManager::create($this->get('formatter'));
            $result = $formatter->run($data);
        }

        if ($validate === true) {
            if (!General::validateXML($result, $errors, false, new XsltProcess)) {
                $result = html_entity_decode($result, ENT_QUOTES, 'UTF-8');
                $result = $this->__replaceAmpersands($result);

                if (!General::validateXML($result, $errors, false, new XsltProcess)) {
                    return false;
                }
            }
        }

        return $result;
    }
826012
public function format($text = '', string $style = 'none')
    {
        return $this->getStartMark($style) . $text . $this->getClearMark();
    }
204837
function format(text) {
    const lintResult = linter.executeOnText(text)
    return lintResult.results[0].output || text
}
247406
public function html(string $body): ResponseInterface
    {
        $response = $this->responseFactory->createResponse();
        $response->getBody()->write($body);

        return $response->withHeader('Content-type', 'text/html; charset=UTF-8');
    }
8494
static function text($name,$value='',$attrArray=null)
	{
		if(!isset($attrArray['cols'])) $attrArray['cols'] = 60;
		if(!isset($attrArray['rows'])) $attrArray['rows'] = 3;
		$attrStr = self::input_attr($attrArray);
		$forms = "<textarea name='{$name}' id='{$name}' $attrStr>$value</textarea>";
		return $forms;
	}
906432
private static function normalizeBody($body)
    {
        if (\is_array($body)) {
            return http_build_query($body, '', '&', PHP_QUERY_RFC1738);
        }

        if ($body instanceof \Traversable) {
            $body = function () use ($body) { yield from $body; };
        }

        if ($body instanceof \Closure) {
            $r = new \ReflectionFunction($body);
            $body = $r->getClosure();

            if ($r->isGenerator()) {
                $body = $body(self::$CHUNK_SIZE);
                $body = function () use ($body) {
                    while ($body->valid()) {
                        $chunk = $body->current();
                        $body->next();

                        if ('' !== $chunk) {
                            return $chunk;
                        }
                    }

                    return '';
                };
            }

            return $body;
        }

        if (!\is_string($body) && !\is_array(@stream_get_meta_data($body))) {
            throw new InvalidArgumentException(sprintf('Option "body" must be string, stream resource, iterable or callable, %s given.', \is_resource($body) ? get_resource_type($body) : \gettype($body)));
        }

        return $body;
    }
254127
public function setBody($body) {
        if (is_string($body) || is_null($body)) {
            $this->rawBody = $this->body = $body;
        } elseif (is_array($body) || is_bool($body) || is_numeric($body) || $body instanceof \JsonSerializable) {
            $this->rawBody = json_encode($body, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
            $this->body = $body;
        } else {
            $this->rawBody = '';
            $this->body = $body;
        }

        return $this;
    }
499989
private function fromArrayToXmlString(array $array)
    {
        $string = '';

        foreach ($array as $key => $value) {
            $string .= '<' . $key . '>' .
                ((is_array($value))
                    ? $this->fromArrayToXmlString($value)
                    : $value) .
                '</' . $key . '>';
        }

        return $string;
    }
1367296
public static function beforeSaveBody($text)
    {
        static::correctParams();
        $webfilesSubdir = static::$webfilesSubdir;
        $webfilesSubdirOld = static::$webfilesSubdirOld;

        $baseUrl = Yii::$app->urlManager->getBaseUrl();
        $trTable = [
            "src=\"{$baseUrl}/{$webfilesSubdirOld}" => "src=\"@{$webfilesSubdir}", //!! old -> new
            "src=\"{$baseUrl}/{$webfilesSubdir}" => "src=\"@{$webfilesSubdir}",

//...todo add useful here...

        ];
        $text = strtr($text, $trTable);
        return $text;
    }
868342
public function do_text(
        $text,
        $offsetX = 0,
        $offsetY = 0,
        $opacity = 1.0,
        $color = 0x000000,
        $size = 12,
        $font_file = null
    ) {
        return $this->_handler->do_text($text, $offsetX, $offsetY, $opacity, $color, $size, $font_file);
    }
720083
public function format($text)
    {
        $lines = explode("\n", $text);
        foreach ($lines as &$line) {
            $line = ($this->quote) . str_repeat(' ', $this->indent) . $line;
        }
        return Colour::colour(implode("\n", $lines), $this->foregroundColors, $this->backgroundColors);
    }
877507
function formatingFontsArray(array) {
		var fileContent = '',
			file = [],
			buffer = array[0].split('.')[0],
			exp = [];

		function writeResult() {
			var str = buffer + ' [' + exp.join(', ') + ']';
			fileContent += str + '\n';
			grunt.log.ok(str);
		}

		array.forEach(function(item, i, arr) {
			file = item.split('.');
			if (buffer === file[0]) {
				exp.push(file[1]);
			} else {
				writeResult();
				buffer = file[0];
				exp = [];
				exp.push(file[1]);
			}
		});
		writeResult();

		//Put last search result into file
		grunt.file.mkdir(options.dest);
		grunt.file.write(normalizeDir(options.dest) + '.fonts', fileContent);
	}
1228064
public static function _text($text, $values = array()) {
		_t($text, static::getDomain(), is_array($values) ? $values : array_slice(func_get_args(), 1));
	}
560793
private function parseBody(Node $body): PerLineNode
    {
        $prefix  = '';                       // Text before the (possibly) multi line expression
        $postfix = '';                       // Text before the (possibly) multi line expression
        $lineno  = $body->getTemplateLine(); // The line number where we found the {% perline %} tag

        // If the body does not contain a list of tags, the body itself is the
        // only useful content of the perline tags, so we return only the body
        // tag. This is the case when the perline tags could be removed without
        // an effect in the generated code.
        if (count($body) === 0) {
            return new PerLineNode($body, '', '', $lineno, $this->getTag());
        }

        // Get all the nodes as array, because it will be modified.
        $nodes = $body->getIterator()->getArrayCopy();

        // Check for prefix, the first node should be a text node to have a
        // prefix.
        $first = reset($nodes);
        if ($first instanceof TextNode) {
            $prefix = $first->getAttribute('data');
            array_shift($nodes);
        }

        // Check for postfix, the last node should be a text node to have a
        // postfix.
        $last = end($nodes);
        if ($last instanceof TextNode) {
            $postfix = rtrim($last->getAttribute('data'));
            array_pop($nodes);
        }

        // After we ditched the prefix and postfix there could only be one node
        // left, ready to be returned and used directly. If there are multiple
        // we wrap those in a Twig Node.
        if (count($nodes) === 1) {
            $nodes = current($nodes);
        } else {
            $nodes = new Node($nodes);
        }

        // Return the new structured node.
        return new PerLineNode($nodes, $prefix, $postfix, $lineno, $this->getTag());
    }
520482
public function do_text(
        $text,
        $offsetX = 0,
        $offsetY = 0,
        $opacity = 1.0,
        $color = 0x000000,
        $size = 12,
        $font_file = null
    ) {
        $textColor = imagecolorallocatealpha($this->_image, ($color >> 16) & 0xFF, ($color >> 8) & 0xFF,
            $color & 0xFF, abs(1 - $opacity) * 127);
        if ($font_file) {
            imagettftext($this->_image, $size, 0, $offsetX, $offsetY, $textColor, $this->alias->resolve($font_file), $text);
        } else {
            imagestring($this->_image, $size, $offsetX, $offsetY, $text, $textColor);
        }

        return $this;
    }
924144
public function line(string $text, array $style = []): string
    {
        $style += ['bg' => null, 'fg' => static::WHITE, 'bold' => 0];

        $format = $style['bg'] === null
            ? \str_replace(';:bg:', '', $this->format)
            : $this->format;

        $line = \strtr($format, [
            ':bold:' => (int) $style['bold'],
            ':fg:'   => (int) $style['fg'],
            ':bg:'   => (int) $style['bg'] + 10,
            ':text:' => $text,
        ]);

        return $line;
    }