Bug 1962: Add new syspref FineNotifyAtCheckin
[koha.git] / misc / translator / text-extract.pl
1 #!/usr/bin/perl
2 #use strict;
3 #use warnings; FIXME - Bug 2505
4 use HTML::Tree;
5 use Getopt::Std;
6 getopt("f:");
7         my $tree = HTML::TreeBuilder->new; # empty tree
8
9         $tree->parse_file($opt_f);
10         sub give_id {
11                 my $x = $_[0];
12                 foreach my $c ($x->content_list) {
13                         next if (ref($c) && $c->tag() eq "~comment");
14                         next if (ref($c) && $c->tag() eq "script");
15                         next if (ref($c) && $c->tag() eq "style");
16                         if (!ref($c)) {
17                                 print "$c\n";
18                         }
19                         if (ref($c) && $c->attr('alt')) {
20                                 print $c->attr('alt')."\n";
21                         }
22                         if (ref($c) && $c->attr('title')) {
23                                 print $c->attr('title')."\n";
24                         }
25                         if (ref($c) && $c->tag() eq "input" && $c->attr('value')) {
26                                 print $c->attr('value')."\n";
27                         }
28                         if (ref($c) && $c->tag() eq 'meta') {
29                                 print $c->attr('content')."\n ";
30                         }
31                         give_id($c) if ref $c; # ignore text nodes
32                 }
33         };
34         give_id($tree);
35         $tree = $tree->delete;