Changeset 32129 for main/trunk


Ignore:
Timestamp:
02/13/18 10:38:29 (3 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

Location:
main/trunk/greenstone2/perllib/plugins
Files:
3 edited

Legend:

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

    r32122 r32129  
    704704           
    705705    # remove {} around a single character (eg \'{e})
    706     $text =~ s@(\\[`'="^~\.]){(\w)}@{$1$2}@g; #`
     706    $text =~ s@(\\[`'="^~\.])\{(\w)}@{$1$2}@g; #`
    707707
    708708    # \, is another way of doing cedilla \c
     
    711711    # remove {} around a single character for special 1 letter commands -
    712712    # need to insert a space. Eg \v{s}  ->  {\v s}
    713     $text =~ s@(\\[uvcH]){(\w)}@{$1 $2}@g;
     713    $text =~ s@(\\[uvcH])\{(\w)}@{$1 $2}@g;
    714714
    715715    # only do if the text contains a '\' character.
  • main/trunk/greenstone2/perllib/plugins/LaTeXPlugin.pm

    r32122 r32129  
    369369    $text =~ s~\\(?:clearemptydoublepage|newpage)~~g;
    370370    ### counters, contents, environments, labels, etc ###
    371     $text =~ s~\\(?:addcontentsline){.*?}\{.*?}\{.*}~~g;
     371    $text =~ s~\\(?:addcontentsline)\{.*?}\{.*?}\{.*}~~g;
    372372    $text =~ s~\s*\\begin\{itemize}\s*~\n<ul>\n~g;
    373373    $text =~ s~\s*\\end\{itemize}\s*~</li></ul>\n~g;
     
    378378    $text =~ s~<([ou])l>\s*</li>\s*~<$1l>~g;
    379379    }
    380     $text =~ s~\\(?:label|begin|end){.*?}\s*\n?~ ~g; # remove tag and contents
     380    $text =~ s~\\(?:label|begin|end)\{.*?}\s*\n?~ ~g; # remove tag and contents
    381381    $text =~ s~\\(?:tableofcontents|listoffigures)~ ~g;
    382382    ### font sizes/styles ###
     
    689689
    690690    # remove {} around a single character (eg \'{e})
    691     $text =~ s!(\\[`'="^~\.]){(\w)}!{$1$2}!g;  # for emacs indenting... `]);
     691    $text =~ s!(\\[`'="^~\.])\{(\w)}!{$1$2}!g;  # for emacs indenting... `]);
    692692
    693693    ## only in bibtex... not in latex proper?!
     
    697697    # remove {} around a single character for special 1 letter commands -
    698698    # need to insert a space. Eg \v{s}  ->  {\v s}
    699     $text =~ s~(\\[uvcH]){(\w)}~{$1 $2}~g;
     699    $text =~ s~(\\[uvcH])\{(\w)}~{$1 $2}~g;
    700700
    701701    # only do if the text contains a '\' character.
  • 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.