File: regen.pl

package info (click to toggle)
libsyntax-highlight-engine-kate-perl 0.10%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 3,844 kB
  • ctags: 2,233
  • sloc: perl: 84,056; ruby: 176; asm: 166; sh: 162; cpp: 144; jsp: 128; haskell: 116; f90: 99; python: 98; ml: 75; xml: 43; yacc: 37; ansic: 32; tcl: 29; lisp: 24; makefile: 14; awk: 13; php: 5
file content (24 lines) | stat: -rwxr-xr-x 733 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env perl

# use this script to regenerate the test data files in t/perl Add a new file
# to t/perl/before and when you run this, a "highlighted" version will be
# created in t/perl/highlighted directory

use lib 't/lib';
use strict;
use warnings;
use TestHighlight ':all';

my $to_highlight = get_sample_perl_files();
my $total        = keys %$to_highlight;
my $current      = 0;

while ( my ( $orig, $new ) = each %$to_highlight ) {
    $current++;
    print "Processing $current out of $total ($orig)\n";
    my $highlighter = get_highlighter('Perl');
    my $highlighted = $highlighter->highlightText( slurp($orig) );

    open my $fh, '>', $new or die "Cannot open $new for writing: $!";
    print $fh $highlighted;
}