Skip to content

Instantly share code, notes, and snippets.

@mattcarberry
Created April 4, 2014 18:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattcarberry/9980724 to your computer and use it in GitHub Desktop.
Save mattcarberry/9980724 to your computer and use it in GitHub Desktop.
Convert Highlight Languages to Gitweb %ext_highlight Syntax
#!/usr/bin/perl
use strict;
use warnings;
my @high_in = `highlight --list-scripts=langs`;
foreach(@high_in){
my @l = split(/:\s([[:ascii:]]+?)( \( ([\s,[:ascii:]]*) \))*$/, $_);
#Output in gitweb $ext_highlight format
if($l[1]){
print"(map { \$_ => \'$l[1]\' } qw($l[1]";
if($l[3]) {
print " $l[3]";
}
print")),\n";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment