OSDN Git Service

Perl5.26以降における "{", "}" の正規表現検査時のエスケープ対応。
authorkgsoft <kgsoft@users.osdn.me>
Thu, 30 Nov 2017 09:00:29 +0000 (09:00 +0000)
committerkgsoft <kgsoft@users.osdn.me>
Thu, 30 Nov 2017 09:00:29 +0000 (09:00 +0000)
lib/Wiki.pm
lib/Wiki/Parser.pm
plugin/bbs/BBSHandler.pm
plugin/category/CategoryCache.pm
plugin/comment/CommentHandler.pm
plugin/format/FormatBase.pm

index 910c940..57fdd86 100644 (file)
@@ -729,7 +729,7 @@ sub parse_inline_plugin {
        my $text = shift;
        my ($cmd, @args_tmp) = split(/ /,$text);
        my $args_txt = &Util::trim(join(" ",@args_tmp));
-       if($cmd =~ s/}}(.*?)$//){
+       if($cmd =~ s/\}\}(.*?)$//){
                return { command=>$cmd, args=>[], post=>"$1 $args_txt"};
        }
        
index bbc3c2e..a582612 100644 (file)
@@ -89,7 +89,7 @@ sub parse {
                }
                
                # ¥Ñ¥é¥°¥é¥Õ¥×¥é¥°¥¤¥ó
-               if($line =~ /^{{(.+}})$/){
+               if($line =~ /^\{\{(.+\}\})$/){
                        if(!$self->{block}){
                                my $plugin = $self->{wiki}->parse_inline_plugin($1);
                                my $info   = $self->{wiki}->get_plugin_info($plugin->{command});
@@ -101,7 +101,7 @@ sub parse {
                                }
                                next;
                        }
-               } elsif($line =~ /^{{(.+)$/){
+               } elsif($line =~ /^\{\{(.+)$/){
                        if ($self->{block}) {
                                my $plugin = $self->{wiki}->parse_inline_plugin($1);
                                my $info   = $self->{wiki}->get_plugin_info($plugin->{command});
@@ -282,7 +282,7 @@ sub parse_line {
        while ($source ne q{}) {
 
                # ¤É¤Î¥¤¥ó¥é¥¤¥ó Wiki ½ñ¼°¤ÎÀèƬ¤Ë¤â match ¤·¤Ê¤¤¾ì¹ç
-               if (!($source =~ /^(.*?)((?:{{|\[\[?|https?:|mailto:|f(?:tp:|ile:)|'''?|==|__|<<).*)$/)) {
+               if (!($source =~ /^(.*?)((?:\{\{|\[\[?|https?:|mailto:|f(?:tp:|ile:)|'''?|==|__|<<).*)$/)) {
                        # ¥­¡¼¥ï¡¼¥É¸¡º÷¡¦ÃÖ´¹½èÍý¤Î¤ß¼Â»Ü¤·¤Æ½ªÎ»¤¹¤ë
                        push @array, $self->_parse_line_keyword($pre . $source);
                        return @array;
@@ -293,7 +293,7 @@ sub parse_line {
                @parsed = ();
 
                # ¥×¥é¥°¥¤¥ó
-               if ($source =~ /^{{/) {
+               if ($source =~ /^\{\{/) {
                        $source = $';
                        my $plugin = $self->{wiki}->parse_inline_plugin($source);
                        unless($plugin){
index 7a98c56..8485a5a 100644 (file)
@@ -61,7 +61,7 @@ sub do_action {
        
        foreach(@lines){
                $content = $content.$_."\n";
-               if(/^{{bbs\s*.*}}$/ && $flag==0){
+               if(/^\{\{bbs\s*.*\}\}$/ && $flag==0){
                        if($form_count==$count){
                                $content .= "!!$subject - $name (".&Util::format_date(time()).")\n".
                                            "$message\n";
index bbcc1a7..877792d 100644 (file)
@@ -102,7 +102,7 @@ sub get_page_category {
        my @category;
        foreach my $line (split(/\n/,$source)){
                if(index($line," ")!=0 && index($line,"\t")!=0 && index($line,"//")!=0){
-                       while($line =~ /{{(category\s+(.+?)\s*}})/g){
+                       while($line =~ /\{\{(category\s+(.+?)\s*\}\})/g){
                                my $inline = $wiki->parse_inline_plugin($1);
                                if(@{$inline->{args}} > 1 and $inline->{args}->[-1] eq 'nolink'){
                                        pop @{$inline->{args}};
index d2ac2a1..550c0a7 100644 (file)
@@ -56,7 +56,7 @@ sub do_action {
                        # ¿·Ãå½ç¤Î¾ì¹ç
                        if($option eq "reverse"){
                                $content = $content.$_."\n";
-                               if(/^{{comment\s*.*}}$/ && $flag==0){
+                               if(/^\{\{comment\s*.*\}\}$/ && $flag==0){
                                        if($form_count==$count){
                                                $content = $content."*$message - $name (".Util::format_date(time()).")\n";
                                                $flag = 1;
@@ -70,7 +70,7 @@ sub do_action {
                                
                        # Åê¹Æ½ç¤Î¾ì¹ç
                        } else {
-                               if(/^{{comment\s*.*}}$/ && $flag==0){
+                               if(/^\{\{comment\s*.*\}\}$/ && $flag==0){
                                        if($form_count==$count){
                                                $content = $content."*$message - $name (".Util::format_date(time()).")\n";
                                                $flag = 1;
@@ -105,7 +105,7 @@ sub check_comment {
        my $page = shift;
        my @lines = split(/\n/,$wiki->get_page($page));
        foreach(@lines){
-               if(/^{{comment\s*.*}}$/){
+               if(/^\{\{comment\s*.*\}\}$/){
                        return 1;
                }
        }
index 16c7bd0..b7eee15 100644 (file)
@@ -25,15 +25,15 @@ sub convert_to_fswiki {
        
        $self->{block_level} = 0;
        foreach my $line (@lines){
-               if($line =~ /^{{.+}}$/){
+               if($line =~ /^\{\{.+\}\}$/){
                        $buf .= $line."\n";
                        next;
-               } elsif($line =~ /^{{.+$/){
+               } elsif($line =~ /^\{\{.+$/){
                        $self->{block_level}++;
                        $buf .= $line."\n";
                        next;
                } elsif($self->{block_level} > 0){
-                       if($line eq "}}"){
+                       if($line eq "\}\}"){
                                $self->{block_level}--;
                        }
                        $buf .= $line."\n";
@@ -57,10 +57,10 @@ sub convert_from_fswiki {
        
        $self->{block_level} = 0;
        foreach my $line (@lines){
-               if($line =~ /^{{.+}}$/){
+               if($line =~ /^\{\{.+\}\}$/){
                        $buf .= $line."\n";
                        next;
-               } elsif($line =~ /^{{.+$/){
+               } elsif($line =~ /^\{\{.+$/){
                        $self->{block_level}++;
                        $buf .= $line."\n";
                        next;