forked from g0v/moedict-epub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sym2html.pl
executable file
·29 lines (27 loc) · 899 Bytes
/
sym2html.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
#!/usr/bin/perl
use utf8;
binmode(STDIN, ':encoding(utf8)');
binmode(STDOUT, ':encoding(utf8)');
print <<EOF;
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Characters</title>
</head>
<body>
<table style="font-size: 20px; font-family: 'HAN NOM A', 'HAN NOM B', serif;">
EOF
while ($line = <STDIN>) {
if (($moecode, $uchar)=$line=~/^([0-9a-f]{4}) (.*)$/){
print "<tr><td>$moecode</td><td>$uchar</td><td><img src='http://140.111.34.46/dict/fonts/$moecode.gif'></td><td><img src='http://dict.revised.moe.edu.tw/images/$moecode.jpg'></td>";
if (length($uchar) == 1){
$ord = sprintf("%x", ord($uchar));
print "<td><a href='http://www.unicode.org/cgi-bin/GetUnihanData.pl?codepoint=$ord'><img src='http://www.unicode.org/cgi-bin/refglyph?24-$ord'> →</a></td>";
}
print "</tr>\n";
}
}
print <<EOF;
</table></body></html>
EOF