19 |
return $from_utf8->convert($_[0]); |
return $from_utf8->convert($_[0]); |
20 |
} |
} |
21 |
|
|
22 |
use Data::Dumper; |
# Escape <, >, & and ", and to produce valid XML |
23 |
#print Dumper($config); |
my %escape = ('<'=>'<', '>'=>'>', '&'=>'&', '"'=>'"'); |
24 |
|
my $escape_re = join '|' => keys %escape; |
25 |
|
sub e { |
26 |
|
my $out; |
27 |
|
foreach my $v (@_) { |
28 |
|
$v =~ s/($escape_re)/$escape{$1}/g; |
29 |
|
$out .= $v; |
30 |
|
} |
31 |
|
return $out; |
32 |
|
} |
33 |
|
|
34 |
my $spelling_alt; |
my $spelling_alt; |
35 |
# FIX: doesn't work very well |
# FIX: doesn't work very well |
117 |
$s=~s/\*\*+/*/g; |
$s=~s/\*\*+/*/g; |
118 |
|
|
119 |
# limit to some path |
# limit to some path |
120 |
$s = "swishdocpath=($path) and $s" if ($path); |
$s = "swishdocpath=(\"$path\") and $s" if ($path); |
121 |
|
|
122 |
my %params; # optional parametars for swish |
my %params; # optional parametars for swish |
123 |
|
|
134 |
"<a href=\"%s\">%s</a> [%s]<br>\n"; |
"<a href=\"%s\">%s</a> [%s]<br>\n"; |
135 |
|
|
136 |
if ($config->{url}) { |
if ($config->{url}) { |
137 |
printf ($hit_fmt ,"http://".virtual_host().x($config->{url}).$hit->swishdocpath,$hit->swishtitle || 'untitled',$hit->swishrank); |
printf ($hit_fmt ,"http://".virtual_host().x($config->{url}).$hit->swishdocpath,e($hit->swishtitle) || 'untitled',$hit->swishrank); |
138 |
} else { |
} else { |
139 |
printf ($hit_fmt ,$hit->swishdocpath,$hit->swishtitle || 'untitled',$hit->swishrank, map($hit->$_, @properties) ); |
printf ($hit_fmt ,$hit->swishdocpath,e($hit->swishtitle) || 'untitled',$hit->swishrank, map($hit->$_, @properties) ); |
140 |
|
|
141 |
} |
} |
142 |
|
|