/[socialtext-import]/tamtam/tamtam2socialtext.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /tamtam/tamtam2socialtext.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 18 by dpavlin, Wed Dec 12 23:01:18 2007 UTC revision 22 by dpavlin, Thu Dec 13 11:42:24 2007 UTC
# Line 12  use HTTP::Date; Line 12  use HTTP::Date;
12  use POSIX qw/strftime/;  use POSIX qw/strftime/;
13  use File::Slurp;  use File::Slurp;
14  use File::MMagic::XS;  use File::MMagic::XS;
15    use Getopt::Long;
16  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
17    
18  my $debug = 0;  my $debug = 0;
19  my $max = 999;  my $max = 999;
20    
21    GetOptions(
22            'debug+' => \$debug,
23            'max=i' => \$max,
24    );
25    
26  my $page;  my $page;
27  my $page_date;  my $page_date;
28    
# Line 35  find({ Line 41  find({
41                                  'attachment' => '+name',                                  'attachment' => '+name',
42                                  'meta' => 'name',                                  'meta' => 'name',
43                          },                          },
44                          ForceArray => [ 'attachment', 'widget' ],                          ForceArray => [ 'attachment', 'meta', 'widget' ],
45                  ) || die "can't open $path: $!";                  ) || die "can't open $path: $!";
46    
47                  warn "## $path = ",dump( $ref ) if $debug;                  warn "## $path = ",dump( $ref ) if $debug;
# Line 154  sub convert_markup { Line 160  sub convert_markup {
160          $body =~ s,----(\S+),----\n$1,gs;          $body =~ s,----(\S+),----\n$1,gs;
161    
162          # attachments          # attachments
163            $body =~ s,\[attachment:([^\]]+)(gif|png|jpg|jpeg)\],{image: $1$2},gis;
164          $body =~ s,\[attachment:([^\]]+)\],{file: $1},gs;          $body =~ s,\[attachment:([^\]]+)\],{file: $1},gs;
165    
166          return $body;          return $body;
# Line 188  foreach my $name ( keys %$page ) { Line 195  foreach my $name ( keys %$page ) {
195          $body =~ s,``,,gs;          $body =~ s,``,,gs;
196    
197          $body .= qq{          $body .= qq{
198    
199  ----  ----
200    
201  Original http://www.razmjenavjestina.org/$full_name {date: $date}  "original"<http://www.razmjenavjestina.org/$full_name> {date: $date}
202  };  };
203    
204          Encode::_utf8_off( $body );          Encode::_utf8_off( $body );

Legend:
Removed from v.18  
changed lines
  Added in v.22

  ViewVC Help
Powered by ViewVC 1.1.26