Changeset 25499
- Timestamp:
- 2012-04-27T17:12:40+12:00 (12 years ago)
- Location:
- main/trunk/greenstone2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/bin/script/pluginfo.pl
r25167 r25499 130 130 } 131 131 eval "\$$strVariable = \$value"; 132 } 133 134 if ($xml) { 135 &gsprintf::set_print_freetext_for_xml(); 132 136 } 133 137 … … 246 250 push (@plugobj_list, $plugobj); 247 251 } 252 253 &gsprintf::set_print_xml_tags(); 248 254 print STDERR "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; 249 255 print STDERR "<PluginList length=\"" . scalar(@plugin_list) . "\">\n"; … … 270 276 my $plugobj = &plugin::load_plugin_for_info ($plugin); 271 277 if ($xml) { 278 &gsprintf::set_print_xml_tags(); 272 279 $plugobj->print_xml_usage($header); 273 280 } -
main/trunk/greenstone2/perllib/gsprintf.pm
r21289 r25499 50 50 # Ignore the OutputEncoding strings in the resource bundles and output all text in UTF-8 51 51 my $outputstringsinUTF8 = 0; 52 my $freetext_xml_mode = 0; 53 54 55 sub make_freetext_xml_safe 56 { 57 my ($text) = @_; 58 59 $text =~ s/\&/&/g; 60 $text =~ s/\"/"/g; 61 $text =~ s/\</</g; 62 $text =~ s/\>/>/g; 63 64 return $text; 65 } 52 66 53 67 … … 63 77 64 78 # Resolve the string arguments using sprintf, then write out to the handle 65 print $handle sprintf($text_string, @text_arguments); 79 my $text_string_resolved = sprintf($text_string, @text_arguments); 80 81 if ($freetext_xml_mode) { 82 $text_string_resolved = make_freetext_xml_safe($text_string_resolved); 83 } 84 85 print $handle $text_string_resolved; 66 86 } 67 87 … … 156 176 if (!%defaultresourcebundle) { 157 177 # $! will still have the error value for the last failed syscall 158 print STDERR "$! $resourcebundlename\n"; 178 179 my $error_message = "$! $resourcebundlename\n"; 180 181 if ($freetext_xml_mode) { 182 $error_message = make_freetext_xml_safe($error_message); 183 } 184 185 print STDERR $error_message; 186 159 187 # set something so we don't bother trying to load it again 160 188 $defaultresourcebundle{0}=undef; … … 292 320 293 321 322 sub set_print_freetext_for_xml 323 { 324 $freetext_xml_mode = 1; 325 } 326 327 sub set_print_xml_tags 328 { 329 $freetext_xml_mode = 0; 330 } 331 294 332 sub output_strings_in_UTF8 295 333 {
Note:
See TracChangeset
for help on using the changeset viewer.