| 1 |
#!/usr/bin/perl -s |
| 2 |
|
| 3 |
### NOT IN DISTRO |
| 4 |
|
| 5 |
our ($m,$o,$v); |
| 6 |
|
| 7 |
$m ||= 1000; |
| 8 |
|
| 9 |
my $tmx=shift or die("usage:\n\t$0 file.tmx\n"); |
| 10 |
|
| 11 |
my $tmp=$o; |
| 12 |
my @u=(); ## unlink list |
| 13 |
|
| 14 |
unless($o){ |
| 15 |
if($tmx =~ /(.*\/)?(.*).tmx$/){$tmp = "${1}__$2.pdf"} |
| 16 |
else {$tmp = "/tmp/_tmxpdf_$$_.pdf"; |
| 17 |
# @u=($tmp); |
| 18 |
} |
| 19 |
} |
| 20 |
|
| 21 |
|
| 22 |
use strict; |
| 23 |
|
| 24 |
if(not -d "$ENV{HOME}/.gwb"){ mkdir("$ENV{HOME}/.gwb"); } |
| 25 |
if(not -f "$ENV{HOME}/.gwb/tmx.css"){ |
| 26 |
open(F,">","$ENV{HOME}/.gwb/tmx.css") or |
| 27 |
die("cant create'$ENV{HOME}/.gwb/tmx.css'\n"); |
| 28 |
while(<DATA>){ last if /END/; |
| 29 |
print F $_} |
| 30 |
close F; |
| 31 |
} |
| 32 |
system("prince -s $ENV{HOME}/.gwb/tmx.css '$tmx' -o '$tmp' 2> /dev/null"); |
| 33 |
if($v){ system("xpdf -z width -cont -g 1500x1050 '$tmp'")} ; |
| 34 |
unlink (@u); |
| 35 |
|
| 36 |
__DATA__ |
| 37 |
@charset "UTF-8"; |
| 38 |
|
| 39 |
prop { display: none; |
| 40 |
} |
| 41 |
|
| 42 |
tu { display: block; |
| 43 |
border-top: solid red 1px; |
| 44 |
padding: 2pt; |
| 45 |
counter-increment: num; |
| 46 |
page-break-inside: avoid; |
| 47 |
columns:2; |
| 48 |
} |
| 49 |
|
| 50 |
tuv { display: block; |
| 51 |
page-break-inside: avoid; |
| 52 |
margin-bottom: 4pt; } |
| 53 |
|
| 54 |
tuv {color:orange; font-size:70% ; } |
| 55 |
|
| 56 |
/* tuv:lang(pt) {color:olive; } */ |
| 57 |
tuv:lang(pt) {color:LightSeaGreen; } |
| 58 |
tuv:lang(pt_pt){color:LightSeaGreen; } |
| 59 |
tuv:lang(pt-pt){color:LightSeaGreen; } |
| 60 |
tuv:lang(PT_PT){color:LightSeaGreen; } |
| 61 |
tuv:lang(PT-PT){color:LightSeaGreen; } |
| 62 |
tuv:lang(en) {color:DarkCyan; } |
| 63 |
tuv:lang(fr) {color:OrangeRed; } |
| 64 |
|
| 65 |
strong, emph, b { font-weight: bold; } |
| 66 |
|
| 67 |
tuv::before {color: black; font-size:70%; } |
| 68 |
|
| 69 |
tuv[lang]::before { content:counter(num) " " attr(lang) " "; } |
| 70 |
tuv[xml\:lang]::before { content:counter(num) " " attr(xml\:lang) " "; } |
| 71 |
tuv:lang(pt)::before { content:counter(num) " PT "; } |
| 72 |
tuv:lang(en)::before { content:counter(num) " EN "; } |
| 73 |
tuv:lang(es)::before { content:counter(num) " ES "; } |
| 74 |
tuv:lang(fr)::before { content:counter(num) " FR "; } |
| 75 |
tuv:lang(de)::before { content:counter(num) " DE "; } |
| 76 |
tuv:lang(en_GB)::before { content:counter(num) " EN "; } |
| 77 |
tuv:lang(en_US)::before { content:counter(num) " EN "; } |
| 78 |
|
| 79 |
seg { } |
| 80 |
header{ display:none; } |
| 81 |
|
| 82 |
@page{ |
| 83 |
margin: 10mm 10mm 10mm 10mm; |
| 84 |
columns:2; |
| 85 |
size:A4; |
| 86 |
} |
| 87 |
|
| 88 |
@screen{ |
| 89 |
margin: 8mm 8mm 8mm 8mm; |
| 90 |
columns:2; |
| 91 |
size:screen; |
| 92 |
} |
| 93 |
|
| 94 |
/* END */ |
| 95 |
|
| 96 |
=head1 NAME |
| 97 |
|
| 98 |
tmx2pdf-prince - convert TMX files to PDF |
| 99 |
|
| 100 |
=head1 SYNOPSIS |
| 101 |
|
| 102 |
tmx2pdf-prince file.tmx |
| 103 |
tmx2pdf-prince -v file.tmx |
| 104 |
|
| 105 |
=head1 DESCRIPTION |
| 106 |
|
| 107 |
=head2 Options |
| 108 |
|
| 109 |
-v show generated PDF |
| 110 |
-m=20 just process first 20 lines |
| 111 |
-o=file.pdf define outour file (def: "__file.pdf") |
| 112 |
|
| 113 |
=head2 Dependencies |
| 114 |
|
| 115 |
C<prince> converter must be installed |
| 116 |
|
| 117 |
xpdf |
| 118 |
|
| 119 |
=head1 AUTHOR |
| 120 |
|
| 121 |
J.Joao Almeida, [email protected] |
| 122 |
|
| 123 |
=head1 SEE ALSO |
| 124 |
|
| 125 |
perl(1). |
| 126 |
|
| 127 |
prince |
| 128 |
|
| 129 |
xpdf |
| 130 |
|
| 131 |
=cut |
| 132 |
|