function hyperlight_test($file, $lang = null) { global $tests; if ($lang === null) { $lang = $file; } if (!empty($tests) and !in_array(strtolower($lang), $tests)) { return; } $fname = 'tests/' . strtolower($file); $code = file_get_contents($fname); $hl = new Hyperlight($lang); $pretty_name = $hl->language()->name(); $title = $file === $lang ? "<h2>Test for language {$pretty_name}</h2>" : "<h2>Test with file “{$file}” for language {$pretty_name}</h2>"; echo "{$title}\n"; #$lines = count(explode("\n", $code)) - 1; #echo '<ol class="line-numbers">'; #for ($i = 0; $i < $lines; $i++) # echo '<li><div> </div></li>'; #echo '</ol>'; ?> <pre class="source-code <?php echo strtolower($lang); ?> "><?php $hl->renderAndPrint($code); ?> </pre><?php }
function hyperlight_test($file, $lang = null) { global $tests; if ($lang === null) { $lang = $file; } if (!empty($tests) and !in_array(strtolower($lang), $tests)) { return; } $fname = 'tests/' . strtolower($file); $code = file_get_contents($fname); $hl = new Hyperlight($lang); $pretty_name = $hl->language()->name(); $title = $file === $lang ? "<h2>Test for language {$pretty_name}</h2>" : "<h2>Test with file “{$file}” for language {$pretty_name}</h2>"; echo "{$title}\n"; ?> <pre class="source-code <?php echo strtolower($lang); ?> "><?php $hl->renderAndPrint($code); ?> </pre><?php }