Syntax
Appearance
public static function viewHook( $text, $title, $output ) {
// Determine the language
preg_match( '!\.(css|js)$!u', $title->getText(), $matches );
$lang = $matches[1] == 'css' ? 'css' : 'javascript';
// Attempt to format
$geshi = self::prepare( $text, $lang );
if( $geshi instanceof GeSHi ) {
$out = $geshi->parse_code();
if( !$geshi->error() ) {
// Done
$output->addHeadItem( "source-$lang", self::buildHeadItem( $geshi ) );
$output->addHtml( "<div dir=\"ltr\">{$out}</div>" );
return false;
}
}
// Bottle out
return true;
}
int main()
{
double a = 1;
for(int i=0; i<10; ++i)
{
a *= (double)(i+1);
}
printf("fact: %f", (float)a);
return 0;
}