Changeset 31780


Ignore:
Timestamp:
07/07/17 19:19:14 (3 years ago)
Author:
ak19
Message:

When testing GS3.08's GLI on Ubuntu v 16.04, found its perl v 5.22.1 issued warnings about unescaped left brace in regex. As per https://unix.stackexchange.com/questions/238539/automake-error-unescaped-left-brace-in-regex-is-deprecated, in even later versions of perl, this counts as a syntax error rather than resulting in a warning. So making the minimum number of changes that allowed perl to parse the plugins and open GLI successfully, without issuing warnings on perl 5.22.1 on this Ubuntu 16.04.

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

Legend:

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

    r31492 r31780  
    791791
    792792    # quoted { } chars
    793     $text =~ s@\\{@{@g;
     793    $text =~ s@\\\{@{@g;
    794794    $text =~ s@\\}@}@g;
    795795
     
    805805
    806806    $text =~ s@\\infty@infinity@g;       # or unicode 0x221E...
    807     $text =~ s@\^{(.*?)}@<sup>$1</sup>@g; # superscript
     807    $text =~ s@\^\{(.*?)}@<sup>$1</sup>@g; # superscript
    808808    $text =~ s@\^([^\{])@<sup>$1</sup>@g;
    809     $text =~ s@\_{(.*?)}@<sub>$1</sub>@g; # subscript
     809    $text =~ s@\_\{(.*?)}@<sub>$1</sub>@g; # subscript
    810810    $text =~ s@\_([^\{])@<sub>$1</sub>@g;
    811811
  • main/trunk/greenstone2/perllib/plugins/LaTeXPlugin.pm

    r31492 r31780  
    166166
    167167    ###### process latex for the main text ######
    168     $$textref =~ s/^.*?\\begin{document}//s;
    169     $$textref =~ s/\\end{document}.*?$//s;
     168    $$textref =~ s/^.*?\\begin\{document}//s;
     169    $$textref =~ s/\\end\{document}.*?$//s;
    170170    $$textref = $self->process_latex("-html",$$textref);
    171171    $doc_obj->add_utf8_text($cursection, $$textref);
     
    318318    return "<br/>" . $tabbing . "<br/>\n";
    319319    }
    320     $text =~ s@\\begin{tabbing}(.*?)\\end{tabbing}@do_tabbing($1)@ges;
     320    $text =~ s@\\begin\{tabbing}(.*?)\\end\{tabbing}@do_tabbing($1)@ges;
    321321    sub do_tabular {
    322322    my $tabular=shift;
     
    324324    $tabular =~ s~[\\][\\]\s*~</td></tr>\n <tr><td>~g;
    325325    $tabular =~ s~\\hline~~g; # for now...
    326     $tabular =~ s~<td>\s*\\multicolumn{(\d+)}{.*?}~<td colspan="$1">~g;
     326    $tabular =~ s~<td>\s*\\multicolumn\{(\d+)}\{.*?}~<td colspan="$1">~g;
    327327    return "<table border=\"1\">\n <tr><td>"
    328328        . $tabular . "</td></tr></table>\n";
    329329    }
    330     $text =~ s@\\begin{tabular}(?:\[.*?\])?{.*?}(.*?)\\end{tabular} @
     330    $text =~ s@\\begin\{tabular}(?:\[.*?\])?{.*?}(.*?)\\end\{tabular} @
    331331            do_tabular($1)  @xges;
    332332
     
    344344
    345345    # is this an amstext environment, or just custom for that input file?
    346     $text =~ s@\\begin{(algorithm)}(.*?)\\end{\1}@remove_equals($2)@ges;
     346    $text =~ s@\\begin\{(algorithm)}(.*?)\\end\{\1}@remove_equals($2)@ges;
    347347
    348348    # convert latex-style accented characters.
     
    369369    $text =~ s~\\(?:clearemptydoublepage|newpage)~~g;
    370370    ### counters, contents, environments, labels, etc ###
    371     $text =~ s~\\(?:addcontentsline){.*?}{.*?}{.*}~~g;
    372     $text =~ s~\s*\\begin{itemize}\s*~\n<ul>\n~g;
    373     $text =~ s~\s*\\end{itemize}\s*~</li></ul>\n~g;
    374     $text =~ s~\s*\\begin{enumerate}\s*~<ol>\n~g;
    375     $text =~ s~\s*\\end{enumerate}\s*~</li></ol>\n~g;
     371    $text =~ s~\\(?:addcontentsline){.*?}\{.*?}\{.*}~~g;
     372    $text =~ s~\s*\\begin\{itemize}\s*~\n<ul>\n~g;
     373    $text =~ s~\s*\\end\{itemize}\s*~</li></ul>\n~g;
     374    $text =~ s~\s*\\begin\{enumerate}\s*~<ol>\n~g;
     375    $text =~ s~\s*\\end\{enumerate}\s*~</li></ol>\n~g;
    376376    if ($text =~ s~\s*\\item~</li>\n<li>~g) {
    377377    # (count for first list item)
     
    388388    $text =~ s~{\\tt\s*(.*?)}~<tt>$1</tt>~g;
    389389    $text =~ s~\\(?:texttt|tt|ttseries)\s*{(.*?)}~<tt>$1</tt>~g;
    390     $text =~ s~\\emph{(.*?)}~<em>$1</em>~g;
     390    $text =~ s~\\emph\{(.*?)}~<em>$1</em>~g;
    391391    $text =~ s~{\\(?:em|it)\s*(.*?)}~<em>$1</em>~g;
    392392    $text =~ s~{\\(?:bf|bfseries)\s*(.*?)}~<strong>$1</strong>~g;
     
    429429
    430430    # quoted { } chars
    431     $text =~ s~\\{~{~g;
     431    $text =~ s~\\\{~{~g;
    432432    $text =~ s~\\}~}~g;
    433433
     
    479479    $text =~ s~\\cup\b~ U ~g;
    480480
    481     $text =~ s~\\frac\s*{(.+?)}{(.+?)}~math_fraction($1,$2)~ge;
     481    $text =~ s~\\frac\s*{(.+?)}\{(.+?)}~math_fraction($1,$2)~ge;
    482482
    483483    if ($html_markup) {
    484     $text =~ s~\^{(.*?)}~<sup>$1</sup>~g;  # a^b superscript
     484    $text =~ s~\^\{(.*?)}~<sup>$1</sup>~g;  # a^b superscript
    485485    $text =~ s~\^([^\{])~<sup>$1</sup>~g;
    486     $text =~ s~\_{(.*?)}~<sub>$1</sub>~g;  # a_b subscript
     486    $text =~ s~\_\{(.*?)}~<sub>$1</sub>~g;  # a_b subscript
    487487    $text =~ s~\_([^\{])~<sub>$1</sub>~g;
    488488   
  • main/trunk/greenstone2/perllib/plugins/MediaWikiPlugin.pm

    r28560 r31780  
    663663           
    664664  # extract the _content_ macro
    665   $about_page_content =~ m/_content_ {(.|\n)*<\/div>\n\n<\/div>\n}/i;
     665  $about_page_content =~ m/_content_ \{(.|\n)*<\/div>\n\n<\/div>\n}/i;
    666666  $about_page_content = $&;
    667667 
Note: See TracChangeset for help on using the changeset viewer.