ChucK HighLighter

=> Chuck Highlighter v0.9.1

built by Scott Hewitt www.ablelemon.co.uk/chuckhl

=> Is

A syntax highlighter for the musical programming language ChucK. More information about Chuck here. This was created for use in my Chuck a Day Project Aug – Sept 2009.

=> Use

* Copy chuckhlib.php5 and chuckhighlightcss into working directory

* Include chuckhlib.php5 in file
include('chuckhilib.php5');

* Then call function with file to be processed
chuckhighlight("chuckcode/demo.ck");

* Outputs file contents within <div><pre> tages

=> Demo

Online demo here.

=> Download

Download here.

Requires php5

=> Bugs

Does not handle numbers within strings ed. “arg1″ solution: manual add to $looktoignore array

=> Demo

Included in download

<?php
//File must be included
include('chuckhilib.php5');

//call lib function chuckhighlight and then file to highlight
chuckhighlight("chuckcode/demo.ck");

//just draws a line
echo "<hr>";

//works on second file
chuckhighlight("chuckcode/8demo.ck");

?>

=> How

Basic PHP string substitution done using str_replace, this attaches html span tags.

These are styled by the attached css file.

This means that you could swap out the css file for your own styling if you wish.

=> Change Log

v0.9.1
Corrected code to handle multiline comments /* */

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>