Changeset 14657 for gsdl/trunk/perllib/plugins/MediaWikiPlug.pm
- Timestamp:
- 2007-10-11T10:45:56+13:00 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/perllib/plugins/MediaWikiPlug.pm
r14496 r14657 63 63 'type' => "regexp", 64 64 'reqd' => "no", 65 'deft' => "<table([^>]*)id=(\\\"|')toc(\\\"|')(.|\\n)* ?</table>\\n" },65 'deft' => "<table([^>]*)id=(\\\"|')toc(\\\"|')(.|\\n)*</table>\\n" }, 66 66 # set to delete the navigation section 67 67 { 'name' => "delete_nav", … … 127 127 my @head_and_body = split(/<body/i,$$textref); 128 128 my $head = shift(@head_and_body); 129 my $body_text = join("<body", @head_and_body); 129 my $body_text = join("<body", @head_and_body); 130 130 131 131 $head =~ m/<title>(.+)<\/title>/i; … … 159 159 # remove header section, it may contain header images or additional search boxes 160 160 my $header_exp = "<div([^>]*)id=(\"|')container(\"|')([^>]*)>(.|\\n)*<div([^>]*)id=(\"|')column-content"; 161 if($body_text =~ /$header_exp/){ 162 $body_text =~ s/$header_exp/<div$1id='container'$4><div$6id='column-content/isg; 163 } else { 164 $header_exp = "(.|\\n)*?<div([^>]*)?id=(\"|')column-content"; 165 if($body_text =~ /$header_exp/){ 166 $body_text =~ s/$header_exp/<div$2id='column-content/i; 167 } 168 } 161 $body_text =~ s/$header_exp/<div$1id='container'$4><div$6id='column-content/isg; 169 162 170 163 # remove timeline … … 277 270 # comment out the body element because we change the body to div 278 271 $line =~ s/^(\s*)body(\s*){(\s*)$/$1\/*body$2*\/{$3/isg; 279 280 if($line =~ m/^(.+)\{/i || $line =~ m/^(\s)*#/i){ 281 if($line !~ m/wikispecificstyle/i){ 282 $line = "#wikispecificstyle " . $line; 283 } 284 } 285 272 273 if($line =~ m/^(.+)\{/i || $line =~ m/^(\s)*#/i){ 274 $line = "#wikispecificstyle " . $line; 275 } 286 276 $css_content .= $line; 287 277 } … … 385 375 } else { 386 376 $preserve_sections .= "\n$searchbox_section\n"; 387 } 377 } 378 388 379 389 380 if($preserve_sections ne ""){ 390 381 $preserve_sections = "<div id=\"column-one\">\n" . $preserve_sections . "\n</div>\n"; 391 382 } 392 $preserve_sections = "</div></div></div>\n" . $preserve_sections . "\n</body>"; 393 383 $preserve_sections = "</div></div></div>\n" . $preserve_sections . "\n</body>"; 384 394 385 $body_text =~ s/$print_footer/$preserve_sections/isg; 395 386 … … 398 389 my @forms; 399 390 my $form_count = 0; 400 while($body_text =~ m/<form([^>]*)name=("|')([^> "']*)?("|')/isg){401 next if($3 eq " searchform");402 $forms[$form_count++] = $&; 391 while($body_text =~ m/<form([^>]*)name=("|')([^>]*)("|')/isg){ 392 next if($3 eq "q"); 393 $forms[$form_count++] = $&; 403 394 } 404 395 foreach my $form (@forms) { 405 396 $body_text =~ s/$form[\s\S]*?<\/form>//m; 406 } 397 } 398 407 399 408 400 # process links. … … 567 559 # If delete_toc is set, remove toc and tof contents. 568 560 if (defined $self->{'delete_toc'} && ($self->{'delete_toc'} == 1)){ 569 if (defined $self->{'toc_exp'} && $self->{'toc_exp'} =~ /\S/){ 570 # print "\nit matches toc_exp 561 if (defined $self->{'toc_exp'} && $self->{'toc_exp'} =~ /\S/){ 562 # print "\nit matches toc_exp!!\n" if $body_text =~ /$self->{'toc_exp'}/; 571 563 if ($body_text =~ /$self->{'toc_exp'}/) { 572 $body_text =~ s/$self->{'toc_exp'}//i; 564 $body_text =~ s/$self->{'toc_exp'}//i; 573 565 } 574 566 }
Note:
See TracChangeset
for help on using the changeset viewer.