-
Notifications
You must be signed in to change notification settings - Fork 84
/
gen_iconsdemo.pl
executable file
·67 lines (51 loc) · 1.58 KB
/
gen_iconsdemo.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/perl
use strict;
my @cssfiles = qw(font-awesome.min.css openautomation.css fhemSVG.css material-icons.min.css weather-icons.min.css);
my $color='#f0f0f0';
my $html_head = '<!DOCTYPE html>
<html>
<head>
<title>FHEM-Tablet-UI :: Iconfonts Demo</title>
<script src="js/fhem-tablet-ui.js" defer></script>
';
$html_head .= '
</head>
<body style="background-color:#2a2a2a">
';
my $html_foot = '
</body>
</html>';
my $html_icons;
my $html_table;
foreach my $cssfile (@cssfiles) {
$html_icons .= "\n <h2>$cssfile</h2>\n";
$html_table .= "<tr><th><h2 colspan='3'>$cssfile</h2></th></tr>\n";
my %icons;
open CSS, "www/tablet/lib/$cssfile" or die $!;
while(my $line = <CSS>) {
$line =~ s/.path\d+//g;
my @matches = $line =~ /\.([^.'";]*?):before/ig;
for my $match (@matches) {
$icons{$match}++;
}
}
close CSS;
my @icons = sort keys %icons;
for my $icon (@icons) {
$html_icons .= ' <div data-type="symbol" data-icon="'.$icon.'" title="'.$icon.'" data-off-color="'.$color.'"></div>'."\n";
$html_table .= ' <tr><td><div data-type="symbol" data-icon="'.$icon.'" title="'.$icon.'" data-off-color="'.$color.'"></div></td><td>'.$icon.'</td><td>'.$cssfile.'</td></tr>'."\n";
}
}
open HTML, '> icons.html';
print HTML $html_head;
print HTML $html_icons;
print HTML $html_foot;
close HTML;
open HTML, '> icons_table.html';
print HTML $html_head;
print HTML '<table>';
print HTML $html_table;
print HTML '</table>';
print HTML $html_foot;
close HTML;
print "Ok\n";