greenstone.org greenstone wiki greenstone trac planet greenstone

Changeset 14504

Show
Ignore:
Timestamp:
2007-09-07 08:30:19 (1 year ago)
Author:
oranfry
Message:

brought anna's plugin fix into the distribution tag

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gsdl/tags/gsdl-2_74-distribution/perllib/plugins/MediaWikiPlug.pm

    r14270 r14504  
    6363       'type' => "regexp", 
    6464       'reqd' => "no", 
    65        'deft' => "<table([^>]*)id=(\\\"|')toc(\\\"|')(.|\\n)*</table>\\n" },         
     65       'deft' => "<table([^>]*)id=(\\\"|')toc(\\\"|')(.|\\n)*?</table>\\n" },         
    6666     # set to delete the navigation section 
    6767     { 'name' => "delete_nav", 
     
    127127    my @head_and_body = split(/<body/i,$$textref); 
    128128    my $head = shift(@head_and_body); 
    129     my $body_text = join("<body", @head_and_body);   
     129    my $body_text = join("<body", @head_and_body);       
    130130     
    131131    $head =~ m/<title>(.+)<\/title>/i; 
     
    159159    # remove header section, it may contain header images or additional search boxes 
    160160    my $header_exp = "<div([^>]*)id=(\"|')container(\"|')([^>]*)>(.|\\n)*<div([^>]*)id=(\"|')column-content"; 
    161     $body_text =~ s/$header_exp/<div$1id='container'$4><div$6id='column-content/isg; 
     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        } 
    162169     
    163170    # remove timeline 
     
    270277                    # comment out the body element because we change the body to div 
    271278                    $line =~ s/^(\s*)body(\s*){(\s*)$/$1\/*body$2*\/{$3/isg; 
    272                                          
    273                     if($line =~ m/^(.+)\{/i || $line =~ m/^(\s)*#/i){                     
    274                         $line = "#wikispecificstyle " . $line; 
    275                     } 
     279                     
     280                    if($line =~ m/^(.+)\{/i || $line =~ m/^(\s)*#/i){                     
     281                      if($line !~ m/wikispecificstyle/i){ 
     282                        $line = "#wikispecificstyle " . $line; 
     283                      }  
     284                    } 
     285                     
    276286                    $css_content .= $line; 
    277287                } 
     
    559569    # If delete_toc is set, remove toc and tof contents.     
    560570    if (defined $self->{'delete_toc'} && ($self->{'delete_toc'} == 1)){ 
    561         if (defined $self->{'toc_exp'} && $self->{'toc_exp'} =~ /\S/){ 
    562           # print "\nit matches toc_exp!!\n" if $body_text =~ /$self->{'toc_exp'}/; 
     571        if (defined $self->{'toc_exp'} && $self->{'toc_exp'} =~ /\S/){          
     572          # print "\nit matches toc_exp !!\n" if $body_text =~ /$self->{'toc_exp'}/; 
    563573          if ($body_text =~ /$self->{'toc_exp'}/) { 
    564             $body_text =~ s/$self->{'toc_exp'}//i; 
     574            $body_text =~ s/$self->{'toc_exp'}//i;          
    565575          } 
    566576        }