--- tamtam/tamtam2socialtext.pl 2007/12/12 23:01:18 18 +++ tamtam/tamtam2socialtext.pl 2007/12/13 11:42:24 22 @@ -12,11 +12,17 @@ use POSIX qw/strftime/; use File::Slurp; use File::MMagic::XS; +use Getopt::Long; use Data::Dump qw/dump/; my $debug = 0; my $max = 999; +GetOptions( + 'debug+' => \$debug, + 'max=i' => \$max, +); + my $page; my $page_date; @@ -35,7 +41,7 @@ 'attachment' => '+name', 'meta' => 'name', }, - ForceArray => [ 'attachment', 'widget' ], + ForceArray => [ 'attachment', 'meta', 'widget' ], ) || die "can't open $path: $!"; warn "## $path = ",dump( $ref ) if $debug; @@ -154,6 +160,7 @@ $body =~ s,----(\S+),----\n$1,gs; # attachments + $body =~ s,\[attachment:([^\]]+)(gif|png|jpg|jpeg)\],{image: $1$2},gis; $body =~ s,\[attachment:([^\]]+)\],{file: $1},gs; return $body; @@ -188,9 +195,10 @@ $body =~ s,``,,gs; $body .= qq{ + ---- -Original http://www.razmjenavjestina.org/$full_name {date: $date} +"original" {date: $date} }; Encode::_utf8_off( $body );