Ignore:
Timestamp:
2018-02-13T10:38:29+13:00 (6 years ago)
Author:
kjdon
Message:

After () in a regex, {} signifys quantifiers. eg (xx){2,4} - 2-4 occurrences. In later perl versions, it is illegal to have an unescaped { after a ) in a regex. If you actually want to match { you need to escape it. So I have escaped all { following ) in regex

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/plugins/MediaWikiPlugin.pm

    r31780 r32129  
    278278        while(my $line = <INPUT>){
    279279                    # comment out the body element because we change the body to div
    280                     $line =~ s/^(\s*)body(\s*){(\s*)$/$1\/*body$2*\/{$3/isg;
     280                    $line =~ s/^(\s*)body(\s*)\{(\s*)$/$1\/*body$2*\/{$3/isg;
    281281                   
    282282                    if($line =~ m/^(.+)\{/i || $line =~ m/^(\s)*#/i){                   
     
    504504        my $update_extra_dm = 0;       
    505505       
    506         if( $about_package =~ /\S/ && $about_package =~ m/_content_(\s*){/ && $about_package =~ m/$mainpage_toc/){ 
     506        if( $about_package =~ /\S/ && $about_package =~ m/_content_(\s*)\{/ && $about_package =~ m/$mainpage_toc/){ 
    507507       print $outhandle "_content_ macro already changed!!!!\n";
    508508    }
     
    527527          # check if there is a content macro   
    528528          my $content_macro_existed = 0;
    529           $content_macro_existed = ($about_package =~ /(\s*|\n)_content_(\s*){/);
     529          $content_macro_existed = ($about_package =~ /(\s*|\n)_content_(\s*)\{/);
    530530           
    531531          # if there is one
    532532          # append a new section div for toc to the end of the document section                   
    533533          if($content_macro_existed ==1) {
    534             $about_package =~ /(\s*|\n)_content_(\s*){(.|\n)*?}/;
     534            $about_package =~ /(\s*|\n)_content_(\s*)\{(.|\n)*?}/;
    535535            my $content_macro = $&;                         
    536536            my $new_content_macro = $content_macro;
Note: See TracChangeset for help on using the changeset viewer.