/[pub]/suikawiki/script/misc/plugins/link/map.wp2
Suika

Diff of /suikawiki/script/misc/plugins/link/map.wp2

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

revision 1.4 by wakaba, Wed Feb 18 07:22:11 2004 UTC revision 1.10 by wakaba, Fri Mar 19 03:42:06 2004 UTC
# Line 87  FormattingRule: Line 87  FormattingRule:
87        next unless $_->[0];        next unless $_->[0];
88        last if $i++ == $p->{n};        last if $i++ == $p->{n};
89                
       my $li = $list->append_new_node  
                         (type => '#element',  
                          namespace_uri => $NS_XHTML1,  
                          local_name => 'li');  
90        $WIKILINKING->to_wikipage_in_html ({        $WIKILINKING->to_wikipage_in_html ({
91          label => $p->{template},          label => $p->{template},
92        } => {        } => {
# Line 101  FormattingRule: Line 97  FormattingRule:
97          page_lastmodified => $_->[1],          page_lastmodified => $_->[1],
98        }, {        }, {
99          o => $o,          o => $o,
100          parent => $li,          parent => $list->append_new_node
101                            (type => '#element',
102                             namespace_uri => $NS_XHTML1,
103                             local_name => 'li'),
104        });        });
105      }      }
106    
# Line 152  FormattingRule: Line 151  FormattingRule:
151                                     -recursive => $p->{recursive})) {                                     -recursive => $p->{recursive})) {
152          last if $i++ == $p->{n};          last if $i++ == $p->{n};
153                    
         my $li = $list->append_new_node  
                           (type => '#element',  
                            namespace_uri => $NS_XHTML1,  
                            local_name => 'li');  
154          $WIKILINKING->to_wikipage_in_html ({          $WIKILINKING->to_wikipage_in_html ({
155            label => $p->{template},            label => $p->{template},
156          } => {          } => {
# Line 164  FormattingRule: Line 159  FormattingRule:
159            wiki_mode => $p->{mode},            wiki_mode => $p->{mode},
160          }, {          }, {
161            o => $o,            o => $o,
162            parent => $li,            parent => $list->append_new_node
163                              (type => '#element',
164                               namespace_uri => $NS_XHTML1,
165                               local_name => 'li'),
166          });          });
167        }        }
168      } catch SuikaWiki::DB::Util::Error with {      } catch SuikaWiki::DB::Util::Error with {
# Line 175  FormattingRule: Line 173  FormattingRule:
173    
174  FormattingRule:  FormattingRule:
175    @Category[list]:    @Category[list]:
     form-input  
     view  
     view-resource  
   @Name: search-result  
   @Formatting:  
     __ATTRTEXT:%key__;  
     $p->{key} ||= $o->{wiki}->{var}->{page}->stringify (wiki => $o->{wiki});  
     __ATTRTEXT:%case_sensible__;  
     my $word = $p->{case_sensible} ? $p->{key} : lc $p->{key};  
     my @r;  
     my $sr = $o->{wiki}->{db}->get (m__search_result => [$word]);  
     unless ($sr) {  
       for my $page ($o->{wiki}->{db}->keys ('content')) {  
         my $content;  
         try {  
           $content = $o->{wiki}->{db}->get (content => $page);  
         } catch SuikaWiki::DB::Util::Error with {  
           my $err = shift;  
           $err->throw if $err->{-type} eq 'ERROR_REPORTED';  
           $content = undef;  
         };  
         $content = $p->{case_sensible} ? $content : lc $content;  
         $content =~ s/^[^\x0A\x0D]+[\x0D\x0A]+//s;  
         $page = $o->{wiki}->name ($page);  
         my $n_page = $page->stringify (wiki => $o->{wiki});  
         $n_page = lc $n_page unless $p->{case_sensible};  
         if (index ($n_page, $word) > -1) {  
                my $c = $content =~ s/\Q$word\E//g;  
                 push @r, [$page, $c+20];  
               } elsif (index ($word, $n_page) > -1) {  
                 my $c = $content =~ s/\Q$word\E//g;  
                 push @r, [$page, $c+10];  
               } elsif (my $c = $content =~ s/\Q$word\E//g) {  
                 push @r, [$page, $c];  
               }  
       }  
       @r = sort {$b->[1] <=> $a->[1] || $a->[0] cmp $b->[0]} @r;  
       $sr = join "\x1E",  
             map {$_->[0]->stringify (wiki => $o->{wiki}, delimiter => "\x1D")  
                  ."\x1F".$_->[1]} @r;  
       $o->{wiki}->{db}->set (m__search_result => [$word] => $sr);  
 ## TODO: Cache & case-sensibility  
     } else {  
       @r = map {[$o->{wiki}->name ($_->[0], delimiter_reg => qr/\x1D/), $_->[1]]}  
            map {[split /\x1F/, $_, 2]} split /\x1E/, $sr;  
     }  
       return unless @r;  
       my $list = $p->{-parent}->append_new_node  
                                 (type => '#element',  
                                  namespace_uri => $NS_XHTML1,  
                                  local_name => 'ol');  
       __ATTRTEXT:%template__;  
       $p->{template} ||= $WIKIRESOURCE->get  
           (name => 'Link:toWikiPage:SourceLabelLong:SearchResult',  
            wiki => $o->{wiki}, o => $o);  
       for (@r) {  
         my $li = $list->append_new_node  
                           (type => '#element',  
                            namespace_uri => $NS_XHTML1,  
                            local_name => 'li');  
         $WIKILINKING->to_wikipage_in_html ({  
           label => $p->{template},  
         } => {  
           base => $o->{wiki}->{var}->{page},  
           page_name_relative => $_->[0],  
           wiki_mode => $p->{mode},  
         }, {  
           o => $o,  
           parent => $li,  
           -m__weight => $_->[1],  
         });  
       }  
   
 FormattingRule:  
   @Category[list]:  
176      page-link      page-link
177    @Name: m--link-weight    @Name: m--link-weight
178    @Formatting:    @Formatting:
# Line 258  FormattingRule: Line 181  FormattingRule:
181  ViewFragment:  ViewFragment:
182    @Name: ws--post-content    @Name: ws--post-content
183    @Description:    @Description:
184      @@@: After content body -- navigation bar      @@@: After content body -- children and backward links
185      @@lang:en      @@lang:en
186    @Order: 100    @Order: 100
187    @Formatting:    @Formatting:
# Line 271  ViewFragment: Line 194  ViewFragment:
194                       template => {%resource-as-plain-text (name => {Children:Item});}p,                       template => {%resource-as-plain-text (name => {Children:Item});}p,
195                     );}p,                     );}p,
196      );      );
         %section (  
           id => see-also,  
           title => {%res(name=>SeeAlso);}p, heading,  
           content => {%search-result;}p,  
         );  
         %section (  
           id => referer,  
           title => {%res(name=>Referer);}p, heading,  
           content => {%referer-list;}p,  
         );  
197    
198  Resource:  Resource:
199    @Children:Title:    @Children:Title:
# Line 301  Resource: Line 214  Resource:
214        description=>{%page-name(absolute);}p,        description=>{%page-name(absolute);}p,
215      );      );
216      %span(class=>headline,content=>{%page-headline;}p);      %span(class=>headline,content=>{%page-headline;}p);
   @Link:toWikiPage:SourceLabelLong:SearchResult:  
     {%m--link-weight;}  
     %link-to-it(  
       label=>{%page-title(relative);}p,  
       description=>{%page-name(absolute);}p,  
     );  
     %span(class=>headline,content=>{%page-headline;}p);  
217    
218  ## TODO:  ## TODO: Make recent-changes page name customizable
219  ViewFragment:  ViewFragment:
220    @Name: navbar    @Name: navbar
221    @Order: 21    @Order: 21
# Line 317  ViewFragment: Line 223  ViewFragment:
223      %link-to-wikipage (      %link-to-wikipage (
224        page => {RecentChanges},        page => {RecentChanges},
225        label => {%link-to-it (        label => {%link-to-it (
226                   label=>"%res(name=>GoToRecentChanges);"p,          label => {%res (name => GoToRecentChanges);}p,
227                   description=>"%res(name=>GoToRecentChangesLong);"p,          description => {%res (name => GoToRecentChangesLong);}p,
228        );},        );},
229        rel => news,        rel => news,
230      );      );
# Line 333  ViewFragment: Line 239  ViewFragment:
239        label => {%html-link (        label => {%html-link (
240                    description => {%res(name=>GoToRecentChangesLink);}p,                    description => {%res(name=>GoToRecentChangesLink);}p,
241                  );},                  );},
     );  
242        );
243    
244    Resource:
245      @GoToRecentChanges:
246        @@@: Recent
247        @@lang: en
248      @GoToRecentChangesLink:
249        @@@: Recently modified WikiPages list
250        @@lang: en
251      @GoToRecentChangesLong:
252        @@@: Review recently modified WikiPages list
253        @@lang: en

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.10

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24