Render HTML equivalent of markdown
@return string
@param $txt string
437918
function convert($txt) {
		$txt=preg_replace_callback(
			'/(<code.*?>.+?<\/code>|'.
			'<[^>\n]+>|\([^\n\)]+\)|"[^"\n]+")|'.
			'\\\\(.)/s',
			function($expr) {
				// Process escaped characters
				return empty($expr[1])?$expr[2]:$expr[1];
			},
			$this->build(preg_replace('/\r\n|\r/',"\n",$txt))
		);
		return $this->snip($txt);
	}
1179758
protected function renderRawHtml($block)
	{
        $output = $block['content'];
        if (is_callable($this->rawHtmlFilter, true)) {
            $output = call_user_func($this->rawHtmlFilter, $output);
        }
		return $output . "\n";
	}
717085
public function filter(&$text)
    {
        $matches = array();
        if(preg_match_all('#<ktml:markdown>(.*)<\/ktml:markdown>#siU', $text, $matches))
        {
            $engine = $this->getObject('template.engine.factory')
                ->createEngine('markdown', array('template' => $this->getTemplate()));

            foreach($matches[1] as $key => $match)
            {
                $html = $engine->loadString($matches[1][$key])->render();
                $text = str_replace($matches[0][$key], $html, $text);
            }
        }
    }
615523
public function output($txt)
    {
        if (!is_null($this->hook('output', array($txt)))) {
            if (isset($this->owner->template)
                && !empty($this->owner->template)
            ) {
                $this->owner->template->append($this->spot, $txt, false);
            } elseif ($this->owner instanceof App_CLI) {
                echo $txt;
            }
        }
    }
1374208
public function renderBasic() {
        $html = "<textarea rows='$this->rows'";
        $html .= " " . $this->getCompiledAttributes("form-control");
        $html .= ">";
        $html .= $this->value;
        $html .= "</textarea>";
        return $html;
    }
932423
private function parseTxt($txt)
    {
        $result = [];
        $lines = array_map('trim', mb_split('\r\n|\n|\r', $txt));
        // Parse each line individually
        foreach ($lines as $key => $line) {
            // Limit rule length
            $line = mb_substr($line, 0, self::MAX_LENGTH_RULE);
            // Remove comments
            $line = explode('#', $line, 2)[0];
            // Parse line
            $result[] = $this->parseLine($line);
            unset($lines[$key]);
        }
        return in_array(true, $result, true);
    }
1145875
static function getOutputEncodingHtml()
    {

        $txt = '';
        $tmp1 = '<meta http-equiv="Content-Type" content="text/html; charset=';
        $tmp2 = '" />';
        switch (ReporticoApp::getConfig("output_encoding")) {
            case "None":$txt = '';
                break;
            case "UTF8":$txt = $tmp1 . "utf-8" . $tmp2;'<meta charset="utf-8">';
                break;
            default:$txt = $tmp1 . ReporticoApp::getConfig("output_encoding") . $tmp2;
                break;
        }

        return $txt;
    }
1129908
private static function httpDigestParse($txt)
	{
		// protect against missing data
		$needed_parts = array('nonce'=>1, 'nc'=>1, 'cnonce'=>1, 'qop'=>1, 'username'=>1, 'uri'=>1, 'response'=>1);
		$data = array();
		$keys = implode('|', array_keys($needed_parts));

		preg_match_all('@(' . $keys . ')=(?:([\'"])([^\2]+?)\2|([^\s,]+))@', $txt, $matches, PREG_SET_ORDER);

		foreach ($matches as $m) {
			$data[$m[1]] = $m[3] ? $m[3] : $m[4];
			unset($needed_parts[$m[1]]);
		}

		return $needed_parts ? false : $data;
	}
134350
public function renderText($text, bool $escape = true): string
    {
        if ($escape) {
            $text = $this->esc($text);
        }
        return (string) Container::getMarkdown()->text((string) $text);
    }
99346
public static function formatText(string $text, Tree $tree): string
    {
        switch ($tree->getPreference('FORMAT_TEXT')) {
            case 'markdown':
                return '<div class="markdown" dir="auto">' . self::markdown($text, $tree) . '</div>';
            default:
                return '<div class="markdown" style="white-space: pre-wrap;" dir="auto">' . self::expandUrls($text, $tree) . '</div>';
        }
    }
689345
private function sanitize($txt)
    {
        // si no se paso un texto o bien es un número no se hace nada
        if (!$txt or is_numeric($txt))
            return $txt;
        // convertir "predefined entities" de XML
        $txt = str_replace(
            ['&amp;', '&#38;', '&lt;', '&#60;', '&gt;', '&#62', '&quot;', '&#34;', '&apos;', '&#39;'],
            ['&', '&', '<', '<', '>', '>', '"', '"', '\'', '\''],
            $txt
        );
        $txt = str_replace('&', '&amp;', $txt);
        /*$txt = str_replace(
            ['&', '"', '\''],
            ['&amp;', '&quot;', '&apos;'],
            $txt
        );*/
        // entregar texto sanitizado
        return $txt;
    }
368771
def markdown(text)
      @renderer ||= Redcarpet::Markdown.new(ExternalLinks, no_intra_emphasis: true)
      smartify(@renderer.render(text))
    end
1170454
protected function renderPlainText($xml)
	{
		// Remove the <t> and </t> tags
		$html = substr($xml, 3, -4);

		// Replace all <br/> with <br>
		$html = str_replace('<br/>', '<br>', $html);

		// Decode encoded characters from the Supplementary Multilingual Plane
		$html = $this->decodeSMP($html);

		return $html;
	}
512652
private function renderPlainText(&$content, $text, $encoding, $boundary)
    {
        $content .= "\r\n";
        $content .= "--$boundary\r\n";
        $content .= "Content-Type: text/plain;\r\n\tcharset=\"$encoding\"\r\n";
        $content .= "Content-Transfer-Encoding: quoted-printable\r\n";
        $content .= "\r\n";
        $content .= "$text\r\n";
    }
1053007
protected function render_text(): string
    {
        return '<input type="text" '.$this->metaString().
            ' id="'.$this->escape->attr($this->id).
            '" name="'.$this->escape->attr($this->name).
            '" value="'.$this->escape->attr($this->value).'" />';
    }
904723
public function DKIM_QP($txt)
    {
        $line = '';
        $len = strlen($txt);
        for ($i = 0; $i < $len; ++$i) {
            $ord = ord($txt[$i]);
            if (((0x21 <= $ord) and ($ord <= 0x3A)) or $ord == 0x3C or ((0x3E <= $ord) and ($ord <= 0x7E))) {
                $line .= $txt[$i];
            } else {
                $line .= '=' . sprintf('%02X', $ord);
            }
        }

        return $line;
    }
15008
protected function buildMarkdownText($markdown, $data)
    {
        return $this->textView
                ?? $markdown->renderText($this->markdown, $data);
    }