Created
April 4, 2014 18:41
-
-
Save mattcarberry/9980724 to your computer and use it in GitHub Desktop.
Convert Highlight Languages to Gitweb %ext_highlight Syntax
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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