martymart has asked for the wisdom of the Perl Monks concerning the following question:
I would like to hear your thoughts on the following...
I have a large bunch of html files... they are eventually going to be copied and any localisable strings in them (US strings naturally) is going to be replaced with locale text (German for example). Replacing the text in these files is easy enough, its pulling the relevant strings out to some text file for the translators thats giving me grief. I've tried using HTML::PullParser and it seems to work quite well at pulling out strings, any thoughts on how to get this to work for alt text aswell?? as its used quite a bit
Am I going about this the right way? Many Thanks#!/usr/bin/perl use warnings; use strict; use HTML::PullParser; OPEN (SOURCE, "Somehtmlfile.html")||die"Can't create $1: $!"; my @source=<SOURCE>; close (SOURCE); my @dest=strip ("@source"); print "@dest"; sub strip { my $html = shift; my $parser = HTML::PullParser->new( doc => $html, text => 'text', ); my $result = ''; while(my $t = $parser->get_token) { $result .= $t->[0]; } return $result; };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: pulling strings from html files...
by allolex (Curate) on May 27, 2003 at 11:47 UTC | |
|
Re: pulling strings from html files...
by crenz (Priest) on May 27, 2003 at 11:15 UTC |