/** * Recieves the result string from GeSHiStyler. The result string will * have gone through the renderer and so be ready to use. * * This method makes sure error cases are handled, and frees any memory * used by the parse run * * @return The code, post-processed. */ protected function _parsePostProcess() { // @todo [blocking 1.1.5] (bug 5) Evaluate feasability and get working if possible the functionality below... //$result = preg_replace('#([^"])(((https?)|(ftp))://[a-z0-9\-]+\.([a-z0-9\-\.]+)+/?([a-zA-Z0-9\.\-_%]+/?)*\??([a-zA-Z0-9=&\[\];%]+)?(\#[a-zA-Z0-9\-_]+)?)#', '\\1<a href="\\2">\\2</a>', $result); //$result = preg_replace('#([a-z0-9\._\-]+@[[a-z0-9\-\.]+[a-z]+)#si', '<a href="mailto:\\1">\\1</a>', $result); // Destroy root context, we don't need it anymore $this->_rootContext = null; // Get code $code = $this->_styler->getParsedCode(); // Trash the old GeSHiStyler $this->_styler = geshi_styler(true); return $code; }
/** * Parse a CSS string into our internal data format * * @param mixed The input format information to convert * @return array */ function _parseCSS($style) { $result = array("font" => array("color" => array("R" => 0.0, "G" => 0.0, "B" => 0.0, "A" => 0.0), "style" => array("bold" => false, "italic" => false, "underline" => 0, "strike" => false), "special" => array("rotate" => 0)), "border" => array("l" => false, "r" => false, "t" => false, "b" => false), "back" => array("color" => false)); if (is_array($style)) { return GeSHiStyler::array_merge_recursive_unique($style, $result); } //No array, so we have to parse CSS ... //First of the color: if (preg_match('/\\b(?<!-)color\\s*:\\s*(#(?i:[\\da-f]{3}(?:[\\da-f]{3})?)|\\w+)/', $style, $match)) { //We got a text color, let's analyze it: $result['font']['color'] = GeSHiStyler::_parseColor($match[1]); } if (preg_match('/\\b(?<!-)font-style\\s*:\\s*(\\w+)/', $style, $match)) { //We got an italics setting $result['font']['style']['italic'] = 'italic' == strtolower($match[1]); } if (preg_match('/\\b(?<!-)font-weight\\s*:\\s*(\\w+)/', $style, $match)) { //We got a bold setting $result['font']['style']['bold'] = 'bold' == strtolower($match[1]); } if (preg_match('/\\b(?<!-)text-decoration\\s*:\\s*(\\w+)/', $style, $match)) { //We got an underline setting $result['font']['style']['underline'] = 'underline' == strtolower($match[1]); } return $result; }
/** * Adds parse data for the end of a context to the overallresult */ function _addParseDataEnd($code) { $this->_styler->addParseDataEnd($code, $this->_contextName, $this->_endName, $this->_complexFlag); }