/[webpac2]/trunk/lib/WebPAC/Output/SWISH.pm
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 /trunk/lib/WebPAC/Output/SWISH.pm

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

revision 1167 by dpavlin, Sat Apr 25 17:12:44 2009 UTC revision 1247 by dpavlin, Wed Jul 22 12:53:07 2009 UTC
# Line 18  use File::Path qw/mkpath/; Line 18  use File::Path qw/mkpath/;
18  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
19  use YAML;  use YAML;
20  use JSON;  use JSON;
21    #use Encode qw/encode encode_utf8 is_utf8/;
22    use Text::Unaccent::PurePerl qw/unac_string/;
23    
24    
25  =head1 NAME  =head1 NAME
# Line 168  sub add { Line 170  sub add {
170                  next if ! $vals;                  next if ! $vals;
171    
172                  $vals =~ s/($escape_re)/$escape{$1}/gs;                  $vals =~ s/($escape_re)/$escape{$1}/gs;
173                    $data->{$tag} = $vals;
174                    $vals = unac_string( $vals );
175    
176                  # BW & EW are our markers for tag boundry                  # BW & EW are our markers for tag boundry
177                  $xml .= qq{<$tag><![CDATA[BW $vals EW]]></$tag>};                  $xml .= qq{<$tag><![CDATA[BW $vals EW]]></$tag>};
178    #               $xml .= qq{<!-- } . is_utf8( $vals ) . qq{!>};
179    
180                  $self->{stats}->{attr}->{$tag}++;                  $self->{stats}->{attr}->{$tag}++;
181                  $self->{stats}->{input}->{ $self->input }->{$tag}++;                  $self->{stats}->{input}->{ $self->input }->{$tag}++;
182    
                 $data->{$tag} = $vals;  
183          }          }
184    
185          # serialize to JSON instead of YAML because we will loose whitespace          # serialize to JSON instead of YAML because we will loose whitespace
186          $data = to_json($data);          $data = to_json($data, {utf8=>1});
187          $xml .= qq{<data><![CDATA[$data]]></data>};          $xml .= qq{<data><![CDATA[$data]]></data>};
188    
189          $xml .= qq{</all>\n};          $xml .= qq{</all>\n};
190    
191    #       $xml = encode('utf-8', $xml);
192    
193            use bytes;
194          my $len = length($xml);          my $len = length($xml);
195    
196          my $fh = $self->{_swish_fh} || die "_swish_fh missing";          my $fh = $self->{_swish_fh} || die "_swish_fh missing";

Legend:
Removed from v.1167  
changed lines
  Added in v.1247

  ViewVC Help
Powered by ViewVC 1.1.26