/[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.9 by wakaba, Sun Mar 24 00:55:15 2002 UTC revision 1.15 by wakaba, Tue Apr 23 10:14:12 2002 UTC
# Line 75  my $preview_color = '#FFCCCC'; Line 75  my $preview_color = '#FFCCCC';
75  ##############################  ##############################
76  # 全ページのスタイル  # 全ページのスタイル
77  my $style = <<'EOD';  my $style = <<'EOD';
78  pre, dl, ul, ol, p, blockquote { line-height:120%; }  @import '/s/simpledoc';
79    pre, dl, ul, ol, p, blockquote { line-height:120%;
80    margin-bottom: 1em}
81    a.wiki .mark    {vertical-align: sub, color: GrayText}
82  a { text-decoration: none; }  a { text-decoration: none; }
83  a:link { color: #0000FF; background-color: #FFFFFF; }  a:link { color: #0000FF; background-color: #FFFFFF; }
84  a:visited { color: #9900CC; background-color: #FFFFFF; }  a:visited { color: #9900CC; background-color: #FFFFFF; }
# Line 578  sub inline { Line 581  sub inline {
581  # ページのタイトルからページの内容を得る  # ページのタイトルからページの内容を得る
582  sub get_page {  sub get_page {
583      my $page_name = shift;      my $page_name = shift;
584      return $database{$page_name};      return $database{$page_name} || $database{'[['.$page_name.']]'};
585  }  }
586    
587  # ページの内容を与える  # ページの内容を与える
# Line 615  sub set_page { Line 618  sub set_page {
618  sub print_header {  sub print_header {
619      my $title = shift;      my $title = shift;
620      print <<"EOD";      print <<"EOD";
621  Content-type: text/html  Content-type: text/html; charset=${charset}
622    
623  <html><head>  <html><head>
624  <title>$title</title>  <title>$title</title>
# Line 645  EOD Line 648  EOD
648  <a href="$thisurl?mycmd=list">一覧</a> |  <a href="$thisurl?mycmd=list">一覧</a> |
649  $editlink  $editlink
650  <a href="$thisurl?mycmd=search">単語検索</a> |  <a href="$thisurl?mycmd=search">単語検索</a> |
651  <a href="$thisurl?mycmd=read;mypage=$whatsnew">最終更新</a>  <a href="$thisurl?mycmd=read;mypage=$whatsnew">最近の更新</a>
652   ]   ]
653  </p>  </p>
654  EOD  EOD
# Line 654  EOD Line 657  EOD
657  # ページのフッタを出力  # ページのフッタを出力
658  sub print_footer {  sub print_footer {
659      print <<"EOD";      print <<"EOD";
660  <address>  <div class="navigation">
 <a href="http://www.hyuki.com/yukiwiki/">YukiWiki</a> 1.6.6 Copyright (C) 2000,2001 by <a href="http://www.hyuki.com/">Hiroshi Yuki.</a>  
 + <a href="$modifierlink">$modifier</a> ${version}.  
661  [<a href="/" title="このサーバーの首頁">/</a>  [<a href="/" title="このサーバーの首頁">/</a>
662  <a href="/map" title="このサーバーの案内">地図</a>  <a href="/map" title="このサーバーの案内">地図</a>
663  <a href="/search/" title="このサーバーの検索">検索</a>]  <a href="/search/" title="このサーバーの検索">検索</a>]
664  </address>  </div>
 </body></html>  
665  EOD  EOD
666      print <<'EOH';
667    <div class="update">
668    <a href="http://www.hyuki.com/yukiwiki/">YukiWiki</a> 1.6.6
669    Copyright &copy; 2000,2001 by <a href="http://www.hyuki.com/">Hiroshi Yuki.</a>
670    <a href="/gate/cvs/wakaba/wiki/" title="CVS Repository">
671    $Revision$ $Date$
672    </a>
673    </div>
674    </body></html>
675    EOH
676  }  }
677    
678  # URLやページの名前からリンクを作る  # URLやページの名前からリンクを作る
# Line 679  sub make_link { Line 689  sub make_link {
689      } elsif ($name =~ /^mailto:(.*)/) {      } elsif ($name =~ /^mailto:(.*)/) {
690          my $address = $1;          my $address = $1;
691          return qq|&lt;<a href="$name">$address</a>&gt;|;          return qq|&lt;<a href="$name">$address</a>&gt;|;
692      } elsif ($name =~ /^urn:[0-9A-Za-z_:-]+/) {      } elsif ($name =~ m#^urn:[0-9A-Za-z_:;/.-]+#) {
693          return qq|&lt;<a href="/uri-res/N2L?${name}">$name</a>&gt;|;          return qq|&lt;<a href="/uri-res/N2L?${name}">$name</a>&gt;|;
694      } else {      } else {
695        my $name2 = $name; $name2 =~ tr/\x20/-/;        my $name2 = $name; $name2 =~ tr/\x20/-/;
# Line 691  sub make_link { Line 701  sub make_link {
701          return qq|<a href="$thisurl?mycmd=read;mypage=$percent_name" class="wiki">$name</a>|;          return qq|<a href="$thisurl?mycmd=read;mypage=$percent_name" class="wiki">$name</a>|;
702        } else {        } else {
703          my $percent_name = &encode_percent($name2);          my $percent_name = &encode_percent($name2);
704          return qq|<a href="$thisurl?mycmd=edit;mypage=$percent_name" class="wiki newpage">$name?</a>|;          return qq|<a href="$thisurl?mycmd=edit;mypage=$percent_name" class="wiki newpage">$name<span class="mark">?</span></a>|;
705        }        }
706      }      }
707  }  }
# Line 718  sub encode_percent { Line 728  sub encode_percent {
728  sub convert_html {  sub convert_html {
729      my ($txt) = shift;      my ($txt) = shift;
730      my (@txt) = split(/\n/, $txt);      my (@txt) = split(/\n/, $txt);
731        push (@result, '<p>');      ## ad hoc...
732      foreach (@txt) {      foreach (@txt) {
733          chomp;          chomp;
734          if (/^\*\*(.*)/) {          if (/^\*\*\*\*\*(.*)/) {
735                push(@result, splice(@saved), '<h6>' . &inline($1) . '</h6>');
736            } elsif (/^\*\*\*\*(.*)/) {
737                push(@result, splice(@saved), '<h5>' . &inline($1) . '</h5>');
738            } elsif (/^\*\*\*(.*)/) {
739                push(@result, splice(@saved), '<h4>' . &inline($1) . '</h4>');
740            } elsif (/^\*\*(.*)/) {
741              push(@result, splice(@saved), '<h3>' . &inline($1) . '</h3>');              push(@result, splice(@saved), '<h3>' . &inline($1) . '</h3>');
742          } elsif (/^\*(.*)/) {          } elsif (/^\*(.*)/) {
743              push(@result, splice(@saved), '<h2>' . &inline($1) . '</h2>');              push(@result, splice(@saved), '<h2>' . &inline($1) . '</h2>');
# Line 729  sub convert_html { Line 746  sub convert_html {
746          } elsif (/^(-{1,3})(.*)/) {          } elsif (/^(-{1,3})(.*)/) {
747              &back_push('ul', length($1));              &back_push('ul', length($1));
748              push(@result, '<li>' . &inline($2) . '</li>');              push(@result, '<li>' . &inline($2) . '</li>');
749            } elsif (/^(={1,3})(.*)/) {
750                &back_push('ol', length($1));
751                push(@result, '<li>' . &inline($2) . '</li>');
752          } elsif (/^:([^:]+):(.*)/) {          } elsif (/^:([^:]+):(.*)/) {
753              &back_push('dl', 1);              &back_push('dl', 1);
754              push(@result, '<dt>' . &inline($1) . '</dt>', '<dd>' . &inline($2) . '</dd>');              push(@result, '<dt>' . &inline($1) . '</dt>', '<dd>' . &inline($2) . '</dd>');
# Line 741  sub convert_html { Line 761  sub convert_html {
761              push(@result, "<p>");              push(@result, "<p>");
762          } elsif (/^(\s+.*)$/) {          } elsif (/^(\s+.*)$/) {
763              &back_push('pre', 1);              &back_push('pre', 1);
764              push(@result, &escape($1)); # Not &inline, but &escape              #push(@result, &escape($1)); # Not &inline, but &escape
765                push(@result, &inline($1)); # Not &inline, but &escape
766          } else {          } else {
767              push(@result, &inline($_));              push(@result, &inline($_));
768          }          }
# Line 767  sub back_push { Line 788  sub back_push {
788  }  }
789    
790  # 編集可能ページか?  # 編集可能ページか?
791  sub is_editable {  sub is_editable {return 1;
792    ## TODO: ...
793      my ($pagename) = @_;      my ($pagename) = @_;
794      foreach (@uneditable) {      foreach (@uneditable) {
795          if ($pagename eq $_) {          if ($pagename eq $_) {
# Line 780  sub is_editable { Line 802  sub is_editable {
802      return 0;      return 0;
803  }  }
804    
805  # Validな名前か?  # Validな名前か?
806  sub is_valid_name {  sub is_valid_name {
807      my ($pagename) = @_;      my ($pagename) = @_;
808      if ($pagename =~ /^$WikiName$/) {      if ($pagename =~ /^$WikiName$/) {

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.15

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24