| 1 |
#!/usr/bin/perl -w -s |
| 2 |
|
| 3 |
# PODNAME: tmx2html |
| 4 |
# ABSTRACT: Converts a TMX to an HTML formatted page |
| 5 |
|
| 6 |
use strict; |
| 7 |
use warnings; |
| 8 |
|
| 9 |
use XML::TMX; |
| 10 |
use XML::TMX::Reader; |
| 11 |
|
| 12 |
our ($icons,$o,$ff,$v); |
| 13 |
|
| 14 |
my $tmx = shift; |
| 15 |
my $tmx_obj = XML::TMX::Reader->new($tmx); |
| 16 |
my $OUT ; |
| 17 |
|
| 18 |
$o //= "__.html" if $v; |
| 19 |
if ($v and $v eq "1"){ $v="firefox" } |
| 20 |
|
| 21 |
if($o){ open($OUT, ">", $o ) or die("Cant create $o\n") } |
| 22 |
else { $OUT = \*STDOUT } |
| 23 |
|
| 24 |
binmode($OUT,":utf8"); |
| 25 |
|
| 26 |
print $OUT qq{ |
| 27 |
<html> |
| 28 |
<head> |
| 29 |
<style> |
| 30 |
tr { |
| 31 |
background-color: #e0e0e0; |
| 32 |
vertical-align: top; |
| 33 |
} |
| 34 |
tr:nth-child(even) {background-color: #f0f0f0;} |
| 35 |
/* tr:hover {background-color: #c8c8c8;} */ |
| 36 |
tr:hover {background-color: #ffe0e0;} |
| 37 |
</style> |
| 38 |
<title> </title> |
| 39 |
<meta charset="UTF-8"/> |
| 40 |
</head> |
| 41 |
<body> |
| 42 |
}, |
| 43 |
$tmx_obj->to_html(), |
| 44 |
|
| 45 |
qq{</body> |
| 46 |
</html> |
| 47 |
}; |
| 48 |
|
| 49 |
if ($v){system("$v $o") } |
| 50 |
|
| 51 |
__END__ |
| 52 |
|
| 53 |
=pod |
| 54 |
|
| 55 |
=encoding UTF-8 |
| 56 |
|
| 57 |
=head1 NAME |
| 58 |
|
| 59 |
tmx2html - Converts a TMX to an HTML formatted page |
| 60 |
|
| 61 |
=head1 VERSION |
| 62 |
|
| 63 |
version 0.39 |
| 64 |
|
| 65 |
=head1 SYNOPSIS |
| 66 |
|
| 67 |
tmx2html [-icons] file.tmx > file.html |
| 68 |
-o=out-html -- def: __.html |
| 69 |
-v -- show with firefox |
| 70 |
-v=chromium -- show with chromium |
| 71 |
|
| 72 |
=head1 DESCRIPTION |
| 73 |
|
| 74 |
Pretty prints a TMX as an HTML file. Icons for languages can be |
| 75 |
produced, but still buggy. |
| 76 |
|
| 77 |
=head1 AUTHORS |
| 78 |
|
| 79 |
=over 4 |
| 80 |
|
| 81 |
=item * |
| 82 |
|
| 83 |
Alberto Simões <[email protected]> |
| 84 |
|
| 85 |
=item * |
| 86 |
|
| 87 |
José João Almeida <[email protected]> |
| 88 |
|
| 89 |
=back |
| 90 |
|
| 91 |
=head1 COPYRIGHT AND LICENSE |
| 92 |
|
| 93 |
This software is copyright (c) 2010-2017 by Projeto Natura <[email protected]>. |
| 94 |
|
| 95 |
This is free software; you can redistribute it and/or modify it under |
| 96 |
the same terms as the Perl 5 programming language system itself. |
| 97 |
|
| 98 |
=cut |