/[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 24 by dpavlin, Thu Dec 13 12:42:45 2007 UTC revision 27 by dpavlin, Sat Dec 15 13:52:40 2007 UTC
# Line 19  my $debug = 0; Line 19  my $debug = 0;
19  my $max = 999;  my $max = 999;
20  my $attachments = 0;  my $attachments = 0;
21    
22    my @create_tags = (qw/
23    Trazi
24    Nudi
25    SvakodnevneDovitljivosti
26    G33koSkop
27    /);
28    
29  GetOptions(  GetOptions(
30          'debug+' => \$debug,          'debug+' => \$debug,
31          'max=i' => \$max,          'max=i' => \$max,
# Line 85  find({ Line 92  find({
92    
93                  $page->{ $name } = {                  $page->{ $name } = {
94                          content => convert_markup( $data ),                          content => convert_markup( $data ),
95                            original => $data,
96                          date => convert_date( $date ),                          date => convert_date( $date ),
97                          attachments => $attachments,                          attachments => $attachments,
98                  };                  };
# Line 133  sub surround { Line 141  sub surround {
141    
142  sub pre {  sub pre {
143          my $text = shift;          my $text = shift;
144          $text =~ s/^{{{//;          $text =~ s/^{{{\s*//s;
145          $text =~ s/}}}$//;          $text =~ s/\s*}}}$//s;
146          return '.pre' . $text . '.pre';          return "\n.pre\n" . $text . "\n.pre\n";
147  }  }
148    
149  sub convert_markup {  sub convert_markup {
# Line 205  foreach my $name ( keys %$page ) { Line 213  foreach my $name ( keys %$page ) {
213    
214          Encode::_utf8_off( $body );          Encode::_utf8_off( $body );
215    
         $Rester->put_page( $name, { content => $body, date => $date });  
216          print "$name $date\n";          print "$name $date\n";
217    
218            # original markup
219            $Rester->put_page( $name, { content => $p->{original}, date => $date });
220    
221            foreach my $t ( @create_tags ) {
222                    push @tags, $t if $full_name =~ m/$t/i;
223            }
224    
225          foreach ( @tags ) {          foreach ( @tags ) {
226                  $Rester->put_pagetag( $name, $_ );                  $Rester->put_pagetag( $name, $_, { date => $date } );
227                  print "+ tag $_\n";                  print "+ tag $_\n";
228          }          }
229    
# Line 221  foreach my $name ( keys %$page ) { Line 236  foreach my $name ( keys %$page ) {
236                  }                  }
237          }          }
238    
239            # converted page
240            $Rester->put_page( $name, { content => $body, date => $date });
241    
242  }  }
243    

Legend:
Removed from v.24  
changed lines
  Added in v.27

  ViewVC Help
Powered by ViewVC 1.1.26