Fix for Bug 4024, Search history template problems, and other fixes.
[koha.git] / misc / translator / text-extract.pl
blobf876e78195f29ead7916fb0a990290d42e874f66
1 #!/usr/bin/perl
2 use HTML::Tree;
3 use Getopt::Std;
4 getopt("f:");
5 my $tree = HTML::TreeBuilder->new; # empty tree
7 $tree->parse_file($opt_f);
8 sub give_id {
9 my $x = $_[0];
10 foreach my $c ($x->content_list) {
11 next if (ref($c) && $c->tag() eq "~comment");
12 next if (ref($c) && $c->tag() eq "script");
13 next if (ref($c) && $c->tag() eq "style");
14 if (!ref($c)) {
15 print "$c\n";
17 if (ref($c) && $c->attr('alt')) {
18 print $c->attr('alt')."\n";
20 if (ref($c) && $c->attr('title')) {
21 print $c->attr('title')."\n";
23 if (ref($c) && $c->tag() eq "input" && $c->attr('value')) {
24 print $c->attr('value')."\n";
26 if (ref($c) && $c->tag() eq 'meta') {
27 print $c->attr('content')."\n ";
29 give_id($c) if ref $c; # ignore text nodes
32 give_id($tree);
33 $tree = $tree->delete;