Using Perl to Generate Code for SHJS Setup
Post Info Saturday, January 31st, 2009 11:59 am by Cody Print Print this page

Using SHJS for syntax colouring requires includes for each language. Here’s a simple Perl script to generate these includes if you downloaded all the files to a directory and was too lazy to manually type them out

opendir(DIR, ".");
@jsFiles = grep(/\.js$/,readdir(DIR));

$output = '<script type="text/javascript" src="sh_main.js"></script>';
$output .= "\n";

foreach $file(@jsFiles)
{
  $output .= '<script type="text/javascript"';
  $output .= 'src="lang/'.$file.'"></script>'."\n";
}

$output .= '<link type="text/css" rel="stylesheet"';
$output .= 'href="css/sh_style.css">'."\n";

open(FILE, ">generate.txt") or die("Error");
print FILE $output;

2 Responses to “ Using Perl to Generate Code for SHJS Setup ”

  1. CHESTER


    CheapTabletsOnline.Com. Canadian Health&Care.Special Internet Prices.Best quality drugs.No prescription online pharmacy. Online Pharmacy. Buy pills online

    Buy:Viagra Super Active+.Levitra.Viagra Soft Tabs.Soma.Cialis Soft Tabs.Viagra.Viagra Professional.Super Active ED Pack.Cialis Professional.Cialis Super Active+.Viagra Super Force.Tramadol.VPXL.Cialis.Zithromax.Maxaman.Propecia….

  2. JUAN


    NEW FASHION store. Original designers collection at low prices!!! 20 % TO 70 % OFF. END OF SEASON SALE!!!

    BUY FASHION. TOP BRANDS: GUCCI, DOLCE&GABBANA, BURBERRY, DIESEL, ICEBERG, ROBERTO CAVALLI, EMPORIO ARMANI, VERSACE…

Leave a Reply

Get updates as often as we post! Subscribe to our full feed or comments feed.