/[pub]/suikawiki/script/lib/suikawiki.pl
Suika

Diff of /suikawiki/script/lib/suikawiki.pl

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

revision 1.18 by wakaba, Thu Oct 30 07:46:09 2003 UTC revision 1.19 by wakaba, Mon Dec 1 07:45:11 2003 UTC
# Line 8  our %embed_command = ( # Map, main Line 8  our %embed_command = ( # Map, main
8  );  );
9  our $database = bless {}, 'wiki::dummy';  our $database = bless {}, 'wiki::dummy';
10  require SuikaWiki::Name::Space;  require SuikaWiki::Name::Space;
 require Message::Markup::XML;  
11  require SuikaWiki::SrcFormat;  require SuikaWiki::SrcFormat;
12    
13  # [to be obsolete]  # [to be obsolete]
# Line 132  sub code_convert { Line 131  sub code_convert {
131      elsif ($_ eq 'utf-8') { $_ = 'utf8' }      elsif ($_ eq 'utf-8') { $_ = 'utf8' }
132      elsif ($_ eq 'shift_jis') { $_ = 'sjis' }      elsif ($_ eq 'shift_jis') { $_ = 'sjis' }
133    }    }
134      if ($code eq 'iso-8859-1') {
135        return $$contentref; ## TODO:
136      }
137    $$contentref = Jcode->new ($contentref, $srccode)    $$contentref = Jcode->new ($contentref, $srccode)
138      ## Normalize FULLWIDTH characters and IDEOGRAPHIC SPACE      ## Normalize FULLWIDTH characters and IDEOGRAPHIC SPACE
139                        ->tr ("\xA3\xB0-\xA3\xB9\xA3\xC1-\xA3\xDA\xA3\xE1-\xA3\xFA\xA1\xF5\xA1\xA4\xA1\xA5\xA1\xA7\xA1\xA8\xA1\xA9\xA1\xAA\xA1\xAE\xA1\xB0\xA1\xB2\xA1\xBF\xA1\xC3\xA1\xCA\xA1\xCB\xA1\xCE\xA1\xCF\xA1\xD0\xA1\xD1\xA1\xDC\xA1\xF0\xA1\xF3\xA1\xF4\xA1\xF6\xA1\xF7\xA1\xE1\xA1\xE4\xA1\xE3\xA1\xA1\xA2\xAF\xA2\xB0\xA2\xB2\xA2\xB1\xA1\xA1\xC0" => q(0-9A-Za-z&,.:;?!`^_/|()[]{}+$%#*@=>< '"~-))                        ->tr ("\xA3\xB0-\xA3\xB9\xA3\xC1-\xA3\xDA\xA3\xE1-\xA3\xFA\xA1\xF5\xA1\xA4\xA1\xA5\xA1\xA7\xA1\xA8\xA1\xA9\xA1\xAA\xA1\xAE\xA1\xB0\xA1\xB2\xA1\xBF\xA1\xC3\xA1\xCA\xA1\xCB\xA1\xCE\xA1\xCF\xA1\xD0\xA1\xD1\xA1\xDC\xA1\xF0\xA1\xF3\xA1\xF4\xA1\xF6\xA1\xF7\xA1\xE1\xA1\xE4\xA1\xE3\xA1\xA1\xA2\xAF\xA2\xB0\xA2\xB2\xA2\xB1\xA1\xA1\xC0" => q(0-9A-Za-z&,.:;?!`^_/|()[]{}+$%#*@=>< '"~-))
# Line 161  sub convert_format ($$$;%) { Line 163  sub convert_format ($$$;%) {
163    } elsif ($t =~ /HTML|xml/) {    } elsif ($t =~ /HTML|xml/) {
164      if (length $content) {      if (length $content) {
165  my $NS_XHTML1 = 'http://www.w3.org/1999/xhtml';  my $NS_XHTML1 = 'http://www.w3.org/1999/xhtml';
166        my $r = SuikaWiki::Markup::XML->new (namespace_uri => $NS_XHTML1, local_name => 'pre');        my $r = Message::Markup::XML::Node->new
167            (type => '#element', namespace_uri => $NS_XHTML1, local_name => 'pre');
168        $r->append_text ($content);        $r->append_text ($content);
169        return $r;        return $r;
170      } else {      } else {
# Line 313  EOH Line 316  EOH
316    $WIKI->init_view;    $WIKI->init_view;
317    $WIKI->{view}->register_common_modes;    $WIKI->{view}->register_common_modes;
318    
319  ## Main    ## Error handlers
320    use SuikaWiki::DB::Util::Error;
321    my $catcher = catch SuikaWiki::DB::Util::Error with {
322      my $err = shift;
323      my $err_msg = $err->text;
324        $err_msg = caller (3) . '-->' . caller (2) . '-->' . caller (1)
325                 . ($err->{-method} ? '->'.$err->{-method} : '')
326                 . ': '
327                 . (defined $err->{-file} ? $err->{-file} . ': ' : '')  
328                 . (defined $err->{-prop} ? $err->{-prop} . ': ' : '')
329                 . (defined $err->{-key} ? join ('//', @{$err->{-key}}) . ': ' : '')
330                 . $err_msg;
331        if ($WIKI->{config}->{path_to}->{db__content__error_log}) {
332          open LOG, '>>', $WIKI->{config}->{path_to}->{db__content__error_log};
333            print LOG scalar (gmtime), " @{[$$]} {$err->{def}->{level}}: ",
334                      $err_msg, "\n";
335          close LOG;
336        }
337        if ($err->{def}->{level} eq 'fatal' or $err->{def}->{level} eq 'stop') {
338          require Carp;
339          local $Carp::Verbose = 1;
340          Carp::croak $err_msg;
341        }
342    } catch SuikaWiki::View::Implementation::error with {
343      my $err = shift;
344      exit if $err->{type} eq 'ERROR_REPORTED';
345      die $err;
346    };
347    
348    $WIKI->{config}->{catch}->{formatter_view}
349      = catch Message::Util::Formatter::error with {
350      my $err = shift;
351      my $wiki = $err->{-option}->{param}->{wiki};
352      SuikaWiki::Plugin->module_package ('Error')
353                       ->reporting_formatting_template_error ($err, $wiki);
354      $wiki->view_in_mode (mode => '-error', method => 'GET');
355      throw SuikaWiki::View::Implementation::error
356        type => 'ERROR_REPORTED';
357    };
358    
359    $WIKI->{config}->{catch}->{formatter_view_error}
360      = catch Message::Util::Formatter::error with {
361      my $err = shift;
362      my $wiki = $err->{-option}->{param}->{wiki};
363      SuikaWiki::Plugin->module_package ('Error')
364                       ->reporting_formatting_template_error ($err, $wiki);
365      $wiki->view_in_mode (mode => '-error-error', method => 'GET');
366      throw SuikaWiki::View::Implementation::error
367        type => 'ERROR_REPORTED';
368    };
369    
370    ## Main
371    try {
372    $WIKI->view_in_mode    $WIKI->view_in_mode
373      (mode => $WIKI->{var}->{mode},      (mode => $WIKI->{var}->{mode},
374       method => $WIKI->{input}->meta_variable ('REQUEST_METHOD'));       method => $WIKI->{input}->meta_variable ('REQUEST_METHOD'));
375      } $catcher;
376  exit;  exit;
377  END {  END {
378    $WIKI->exit;    try {
379  }      $WIKI->exit;
380      } $catcher;
381    };
382    
383  =head1 NAME  =head1 NAME
384    

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24