1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
<?php
//Colore le code écrit en Ruby !
function ruby($texte)
{
$texte = preg_replace_callback('#\[ruby\](.+)?()\[/ruby\]#isU', 'parse_ruby', $texte);
return $texte;
}
function parse_ruby($capt)
{
$code = trim(htmlspecialchars_decode($capt[1]));
$code = new GeSHi($code, 'ruby');
$code = $code->parse_code(FALSE);
return '<div><div class="tout_selectionner"><a onclick="selectCode(this); return FALSE;" href="#">Tout sélectionner</a></div>' . str_replace("\n", '<br />', $code) . '</div>';
}
?> |
Partager