public function execute() { global $wgPygmentizePath; function lang_filter($val) { return preg_match('/^[a-zA-Z0-9\\-_]+$/', $val); } $header = '// Generated by ' . basename(__FILE__) . "\n\n"; $pygments = new Pygments($wgPygmentizePath); $lexers = array_keys($pygments->getLexers()); sort($lexers); $code = "<?php\n" . $header . 'return ' . var_export($lexers, true) . ";\n"; $code = preg_replace('/(\\d+ \\=\\>| (?=\\())/i', '', $code); $code = preg_replace("/^ +/m", "\t", $code); file_put_contents(__DIR__ . '/../SyntaxHighlight_GeSHi.lexers.php', $code); $this->output("Updated language list written to SyntaxHighlight_GeSHi.lexers.php\n"); }
public function testGetLexers() { $pygments = new Pygments(); $lexers = $pygments->getLexers(); $this->assertArrayHasKey('python', $lexers); }