/[pub]/suikawiki/script/wiki.cgi
Suika

Diff of /suikawiki/script/wiki.cgi

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

revision 1.17 by wakaba, Sun Jun 2 05:41:49 2002 UTC revision 1.20 by wakaba, Sun Jun 2 06:37:36 2002 UTC
# Line 83  my $file_FrontPage = "$modifier_dir_data Line 83  my $file_FrontPage = "$modifier_dir_data
83  my $file_conflict = "$modifier_dir_data/conflict.txt";  my $file_conflict = "$modifier_dir_data/conflict.txt";
84  my $file_format = "$modifier_dir_data/format.txt";  my $file_format = "$modifier_dir_data/format.txt";
85  my $url_cgi = 'wiki';  my $url_cgi = 'wiki';
86  my $url_stylesheet = './WalWiki/Theme/wiki.css';  my $url_stylesheet = 'wiki-style.css';
87  my $icontag = '<img src="/icons/folder" alt="*" width="40" height="40" />';  my $icontag = '<img src="/icons/folder" alt="*" width="40" height="40" />';
88  my $maxrecent = 50;  my $maxrecent = 50;
89  my $cols = 80;  my $cols = 80;
# Line 104  my $InterWikiName = 'InterWikiName'; Line 104  my $InterWikiName = 'InterWikiName';
104  my $RecentChanges = 'RecentChanges';  my $RecentChanges = 'RecentChanges';
105  my $AdminChangePassword = 'AdminChangePassword';  my $AdminChangePassword = 'AdminChangePassword';
106  my $CompletedSuccessfully = 'CompletedSuccessfully';  my $CompletedSuccessfully = 'CompletedSuccessfully';
107  my $FrontPage = 'FrontPage';  my $FrontPage = 'HomePage';
108  my $IndexPage = 'IndexPage';  my $IndexPage = 'IndexPage';
109  my $SearchPage = 'SearchPage';  my $SearchPage = 'SearchPage';
110  my $CreatePage = 'CreatePage';  my $CreatePage = 'CreatePage';
# Line 139  my %fixedpage = ( Line 139  my %fixedpage = (
139      $SearchPage => 1,      $SearchPage => 1,
140      $AdminChangePassword => 1,      $AdminChangePassword => 1,
141      $CompletedSuccessfully => 1,      $CompletedSuccessfully => 1,
142      $FrontPage => 1,      #$FrontPage => 1,
143  );  );
144  my %form;  my %form;
145  my %database;  my %database;
# Line 154  my %page_command = ( Line 154  my %page_command = (
154      $CreatePage => 'create',      $CreatePage => 'create',
155      $RssPage => 'rss',      $RssPage => 'rss',
156      $AdminChangePassword => 'adminchangepasswordform',      $AdminChangePassword => 'adminchangepasswordform',
157      $FrontPage => 'FrontPage',      #$FrontPage => 'FrontPage',
158  );  );
159  my %command_do = (  my %command_do = (
160      read => \&do_read,      read => \&do_read,
# Line 403  sub print_header { Line 403  sub print_header {
403      my $cookedpage = &encode($page);      my $cookedpage = &encode($page);
404      print <<"EOD";      print <<"EOD";
405  Content-type: text/html; charset=$charset  Content-type: text/html; charset=$charset
406    Content-Language: $lang
407    Content-Style-Type: text/css
408    
409  <!DOCTYPE html  <!DOCTYPE html
410      PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"      PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
411      "http://www.w3.org/TR/html4/loose.dtd">      "http://www.w3.org/TR/html4/loose.dtd">
412  <html lang="$lang">  <html lang="$lang">
413  <head>  <head>
     <meta http-equiv="Content-Language" content="$lang">  
     <meta http-equiv="Content-Type" content="text/html; charset=$charset">  
414      <title>$page @{[&escape(&get_subjectline($page))]}</title>      <title>$page @{[&escape(&get_subjectline($page))]}</title>
415      <link rel="index" href="$url_cgi?$IndexPage">      <link rel="index" href="$url_cgi?$IndexPage">
416      <link rev="made" href="mailto:$modifier_mail">      <link rev="made" href="mailto:$modifier_mail">
# Line 447  sub print_footer { Line 447  sub print_footer {
447      my ($page) = @_;      my ($page) = @_;
448      $walrus_log = ($walrus_debugging) ? &text_to_html("----\n$walrus_log") : '';    # Walrus add (debug)      $walrus_log = ($walrus_debugging) ? &text_to_html("----\n$walrus_log") : '';    # Walrus add (debug)
449      # Walrus mod (1) start      # Walrus mod (1) start
450      my $mod_info = $modifier_name ? qq(Modified by <a href="$modifier_url">$modifier_name</a>.) : '';  my $cvslog = '$Revision$ $Date$';
451      print <<"EOD";      print <<"EOD";
452  <div class="footer">  <div class="footer">
 <hr />  
453  <p>  <p>
454  <a href="http://digit.que.ne.jp/work/">WalWiki</a> $walversion &copy; 2000-2002 by <a href="http://digit.que.ne.jp/">Makio Tsukamoto</a>.<br />  <a href="http://digit.que.ne.jp/work/">WalWiki</a> $walversion &copy; 2000-2002 by <a href="http://digit.que.ne.jp/">Makio Tsukamoto</a>.<br />
455  based on <a href="http://www.hyuki.com/yukiwiki/">YukiWiki</a> $version &copy; 2000-2002 by <a href="http://www.hyuki.com/">Hiroshi Yuki</a>.<br />  based on <a href="http://www.hyuki.com/yukiwiki/">YukiWiki</a> $version &copy; 2000-2002 by <a href="http://www.hyuki.com/">Hiroshi Yuki</a>.<br />
456  $mod_info  <a href="/gate/cvs/wakaba/wiki/" title="CVS Repository">
457    $cvslog
458    </a>
459  </p>  </p>
460    <div class="navigation">
461    [<a href="/" title="このサーバーの首頁">/</a>
462    <a href="/map" title="このサーバーの案内">地図</a>
463    <a href="/search/" title="このサーバーの検索">検索</a>]
464  </div>  </div>
465  $walrus_log <!-- Walrus add (debug) -->  </div>
466    $walrus_log
467  </body>  </body>
468  </html>  </html>
469  EOD  EOD
# Line 513  sub text_to_html { Line 519  sub text_to_html {
519      foreach (@txt) {      foreach (@txt) {
520          chomp;          chomp;
521          # Walrus mod (6) start          # Walrus mod (6) start
522          if ($saved[0] eq '</html>') {          #if ($saved[0] eq '</html>') {
523              if (/<\/html>/i) { splice(@saved); }          #    if (/<\/html>/i) { splice(@saved); }
524              else { push (@result, &html_to_ignored_html($_)); }          #    else { push (@result, &html_to_ignored_html($_)); }
525          } elsif (/^<html>/i and &is_ignore_html($form{mypage})) {          #} elsif (/^<html>/i and &is_ignore_html($form{mypage})) {
526              push(@result, splice(@saved));          #    push(@result, splice(@saved));
527              push(@saved, '</html>');          #    push(@saved, '</html>');
528            #} els
529            if (/^\*\*\*\*\*(.*)/) {
530                push(@toc, qq(-- <a href="#i$tocnum">@{[&escape($1)]}</a>\n));
531                push(@result, splice(@saved), qq(<h6 id="i$tocnum">) . &inline($1) . '</h6>');
532                $tocnum++;
533            } elsif (/^\*\*\*\*(.*)/) {
534                push(@toc, qq(-- <a href="#i$tocnum">@{[&escape($1)]}</a>\n));
535                push(@result, splice(@saved), qq(<h5 id="i$tocnum">) . &inline($1) . '</h5>');
536                $tocnum++;
537            } elsif (/^\*\*\*(.*)/) {
538                push(@toc, qq(-- <a href="#i$tocnum">@{[&escape($1)]}</a>\n));
539                push(@result, splice(@saved), qq(<h4 id="i$tocnum">) . &inline($1) . '</h4>');
540                $tocnum++;
541          } elsif (/^\*\*(.*)/) {          } elsif (/^\*\*(.*)/) {
542          # if (/^\*\*(.*)/) {          # if (/^\*\*(.*)/) {
543          # Walrus mod (6) end          # Walrus mod (6) end
# Line 529  sub text_to_html { Line 548  sub text_to_html {
548              push(@toc, qq(- <a href="#i$tocnum">@{[&escape($1)]}</a>\n));              push(@toc, qq(- <a href="#i$tocnum">@{[&escape($1)]}</a>\n));
549              push(@result, splice(@saved), qq(<h2><a name="i$tocnum"> </a>) . &inline($1) . '</h2>');              push(@result, splice(@saved), qq(<h2><a name="i$tocnum"> </a>) . &inline($1) . '</h2>');
550              $tocnum++;              $tocnum++;
551          } elsif (/^----/) {          #} elsif (/^----/) {
552              push(@result, splice(@saved), '<hr>');          #    push(@result, splice(@saved), '<hr>');
553          } elsif (/^(-{1,3})(.*)/) {          } elsif (/^(={1,5})(.*)/) {
554                &back_push('ol', length($1), \@saved, \@result);
555                push(@result, '<li>' . &inline($2) . '</li>');
556            } elsif (/^(-{1,5})(.*)/) {
557              &back_push('ul', length($1), \@saved, \@result);              &back_push('ul', length($1), \@saved, \@result);
558              push(@result, '<li>' . &inline($2) . '</li>');              push(@result, '<li>' . &inline($2) . '</li>');
559          } elsif (/^:([^:]+):(.*)/) {          } elsif (/^:([^:]+):(.*)/) {
560              &back_push('dl', 1, \@saved, \@result);              &back_push('dl', 1, \@saved, \@result);
561              push(@result, '<dt>' . &inline($1) . '</dt>', '<dd>' . &inline($2) . '</dd>');              push(@result, '<dt>' . &inline($1) . '</dt>', '<dd>' . &inline($2) . '</dd>');
562          } elsif (/^(>{1,3})(.*)/) {          } elsif (/^(>{1,5})(.*)/) {
563              &back_push('blockquote', length($1), \@saved, \@result);              &back_push('blockquote', length($1), \@saved, \@result);
564              push(@result, &inline($2));              push(@result, &inline($2));
565          } elsif (/^\s*$/) {          } elsif (/^\s*$/) {
# Line 546  sub text_to_html { Line 568  sub text_to_html {
568              push(@result, "<p>");              push(@result, "<p>");
569          } elsif (/^(\s+.*)$/) {          } elsif (/^(\s+.*)$/) {
570              &back_push('pre', 1, \@saved, \@result);              &back_push('pre', 1, \@saved, \@result);
571              push(@result, &escape($1)); # Not &inline, but &escape              #push(@result, &escape($1)); # Not &inline, but &escape
572                push(@result, &inline($1)); # Not &inline, but &escape
573  #       } elsif (/^\,(.*)$/) {             # Walrus del (BF)  #       } elsif (/^\,(.*)$/) {             # Walrus del (BF)
574          } elsif (/^\,(.*?)[\x0D\x0A]*$/) { # Walrus add (BF)          } elsif (/^\,(.*?)[\x0D\x0A]*$/) { # Walrus add (BF)
575              &back_push('table', 1, \@saved, \@result, ' border="1"');              &back_push('table', 1, \@saved, \@result, ' border="1"');
# Line 611  sub back_push { Line 634  sub back_push {
634  sub inline {  sub inline {
635      my ($line) = @_;      my ($line) = @_;
636      $line = &escape($line);      $line = &escape($line);
637      $line =~ s|'''([^']+?)'''|<i>$1</i>|g;  # Italic      $line =~ s|'''([^']+?)'''|<strong>$1</strong>|g;
638      $line =~ s|''([^']+?)''|<b>$1</b>|g;    # Bold      $line =~ s|''([^']+?)''|<em>$1</em>|g;
639      $line =~ s|(\d\d\d\d-\d\d-\d\d \(\w\w\w\) \d\d:\d\d:\d\d)|<span class="date">$1</span>|g;   # Date      $line =~ s|(\d\d\d\d-\d\d-\d\d \(\w\w\w\) \d\d:\d\d:\d\d)|<span class="date">$1</span>|g;   # Date
640      $line =~ s!      $line =~ s!
641                  (        (
642                      ((mailto|http|https|ftp):([^\x00-\x20()<>\x7F-\xFF])*)  # Direct http://...          (?:&lt;(?:mailto|http|https|ftp|urn):[\x21-\x7E]*)&gt;
643                          |        |
644                      ($bracket_name)             # [[likethis]], [[#comment]], [[Friend:remotelink]]          ($bracket_name) # [[likethis]], [[#comment]], [[Friend:remotelink]]
645                          |        |
646                      ($interwiki_definition)     # [[Friend http://somewhere/?q=sjis($1)]]          ($interwiki_definition) # [[Friend http://somewhere/?q=sjis($1)]]
647                          |        #|
648                      ($wiki_name)                # LocalLinkLikeThis        #  ($wiki_name)
649                  )        )
650              !              !
651                  &make_link($1)                  &make_link($1)
652              !gex;              !gex;
# Line 634  sub make_link { Line 657  sub make_link {
657      my $chunk = shift;      my $chunk = shift;
658      # Walrus add (3) start      # Walrus add (3) start
659      my $name  = $chunk;      my $name  = $chunk;
660        $name =~ s/^&lt;(.*)&gt;$/$1/;
661      if ($chunk =~ /^\[\[([^ ]+?) ([^ ]+?)\]\]$/ and $form{mypage} ne $InterWikiName) {      if ($chunk =~ /^\[\[([^ ]+?) ([^ ]+?)\]\]$/ and $form{mypage} ne $InterWikiName) {
662          ($name, $chunk) = ($1, $2);          ($name, $chunk) = ($1, $2);
663      } elsif ($chunk =~ /^mailto:(.*)$/) {      } elsif ($chunk =~ /^mailto:(.*)$/) {
# Line 653  sub make_link { Line 677  sub make_link {
677  #       }  #       }
678          return qq(<a href="$chunk">$name</a>);          return qq(<a href="$chunk">$name</a>);
679          # Walrus mod (3) end          # Walrus mod (3) end
680      } elsif ($chunk =~ /^(mailto):(.*)/) {      } elsif ($chunk =~ m#^urn:[0-9A-Za-z_:;/.-]+#) {
681            return qq|&lt;<a href="/uri-res/N2L?${name}">$name</a>&gt;|;
682        } elsif ($chunk =~ /^mailto:(.*)/) {
683  #       return qq(<a href="$chunk">$2</a>);                 # Walrus del (3)  #       return qq(<a href="$chunk">$2</a>);                 # Walrus del (3)
684          return qq(<a href="$chunk">$name</a>);              # Walrus add (3)          return qq(&lt;<a href="$chunk">$name</a>&gt;);              # Walrus add (3)
685      } elsif ($chunk =~ /^$interwiki_definition$/) {      } elsif ($chunk =~ /^$interwiki_definition$/) {
686  #       return qq(<span class="InterWiki">$chunk</span>);   # Walrus del (3)  #       return qq(<span class="InterWiki">$chunk</span>);   # Walrus del (3)
687          return qq(<span class="InterWiki">$name</span>);    # Walrus add (3)          return qq(<span class="InterWiki">$name</span>);    # Walrus add (3)
# Line 683  sub make_link { Line 709  sub make_link {
709              return qq(<a title="$subject" href="$url_cgi?$cookedchunk">$name</a>);   # Walrus add (3)              return qq(<a title="$subject" href="$url_cgi?$cookedchunk">$name</a>);   # Walrus add (3)
710          } elsif ($page_command{$chunk}) {          } elsif ($page_command{$chunk}) {
711  #           return qq(<a title="$chunk" href="$url_cgi?$cookedchunk">$chunk</a>);    # Walrus del (3)  #           return qq(<a title="$chunk" href="$url_cgi?$cookedchunk">$chunk</a>);    # Walrus del (3)
712              return qq(<a title="$chunk" href="$url_cgi?$cookedchunk">$name</a>);     # Walrus add (3)              return qq(<a title="$chunk" href="$url_cgi?$cookedchunk" class="wiki">$name</a>);     # Walrus add (3)
713          } else {          } else {
714  #           return qq($chunk<a title="$resource{editthispage}" href="$url_cgi?mycmd=edit&amp;mypage=$cookedchunk">$editchar</a>); # Walrus del (3)              return qq(<a title="$resource{editthispage}" href="$url_cgi?mycmd=edit;mypage=$cookedchunk" class="wiki">$name<span class="mark">$editchar</span></a>);
             return qq($name<a title="$resource{editthispage}" href="$url_cgi?mycmd=edit&amp;mypage=$cookedchunk">$editchar</a>);  # Walrus add (3)  
715          }          }
716      }      }
717  }  }

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.20

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24