/** * Converts the templates into HTML documents based on the file type. * * @param string $path The filename of the template. * @return string The converted HTML content from that template. * * @todo Rewrite this method. */ public static function convertToHTML($path) { $pathinfo = pathinfo($path); $extension = strtolower($pathinfo['extension']); switch ($extension) { // Markdown case 'md': case 'mdown': case 'markdown': return trim(SmartyPants(Markdown(file_get_contents($path)))); break; // PHP-infused HTML // PHP-infused HTML case 'phtml': Generator::start(); include $path; $phtml_content = Generator::end(); return SmartyPants(trim($phtml_content)); break; // Pre-formatted text // Pre-formatted text case '': case 'txt': case 'text': return '<pre>' . trim(file_get_contents($path)) . '</pre>'; break; // Plain ol' HTML // Plain ol' HTML default: return trim(SmartyPants(file_get_contents($path))); break; } }