/[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 11 by dpavlin, Wed Dec 12 14:04:11 2007 UTC revision 13 by dpavlin, Wed Dec 12 17:14:58 2007 UTC
# Line 40  find({ Line 40  find({
40                          $ref->{widgets}->{widget}->{Body}->{data} ||                          $ref->{widgets}->{widget}->{Body}->{data} ||
41                          die "no data in $path ",dump( $ref );                          die "no data in $path ",dump( $ref );
42    
43                    $data .= qq{
44    ----
45    
46    Original: http://www.razmjenavjestina.org/$path
47    };
48    
49                  $page->{ $name } = [ $data, $date ];                  $page->{ $name } = [ $data, $date ];
50    
51                  # strip path from page name                  # strip path from page name
52                  $name =~ s,^.+/([^/]+)$,$1,;                  $name =~ s,^.+/([^/]+)$,$1,;
53                  push @page_names, $name;                  push @page_names, $name;
54    
55                  #warn dump( $ref );  #               warn dump( $ref );
56          },          },
57  }, shift @ARGV || '.');  }, shift @ARGV || '.');
58    
# Line 79  sub surround { Line 85  sub surround {
85          return $with . $what . $with;          return $with . $what . $with;
86  }  }
87    
88    sub pre {
89            my $text = shift;
90            $text =~ s/^{{{//;
91            $text =~ s/}}}$//;
92            return '.pre' . $text . '.pre';
93    }
94    
95  my $count = 0;  my $count = 0;
96    
97  foreach my $name ( keys %$page ) {  foreach my $name ( keys %$page ) {
# Line 93  foreach my $name ( keys %$page ) { Line 106  foreach my $name ( keys %$page ) {
106          $body =~ s/''''(.+?)''''/surround('`',$1)/gse;          $body =~ s/''''(.+?)''''/surround('`',$1)/gse;
107          $body =~ s/'''(.+?)'''/surround('*',$1)/gse;          $body =~ s/'''(.+?)'''/surround('*',$1)/gse;
108          $body =~ s/''(.+?)''/surround('_',$1)/gse;          $body =~ s/''(.+?)''/surround('_',$1)/gse;
109            $body =~ s/$RE{balanced}{-begin => "{{{"}{-end => "}}}"}{-keep}/pre($1)/gse;
110    
111          # fix bullets          # fix bullets
112          $body =~ s/^\s+([\*])/$1/gm;          $body =~ s/^\s+([\*])/$1/gm;

Legend:
Removed from v.11  
changed lines
  Added in v.13

  ViewVC Help
Powered by ViewVC 1.1.26