Ignore:
Timestamp:
2018-02-13T10:38:29+13:00 (4 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/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.
Note: See TracChangeset for help on using the changeset viewer.