diff --git a/lib/TWiki.pm b/lib/TWiki.pm index ff0e7bd..57de5d7 100644 --- a/lib/TWiki.pm +++ b/lib/TWiki.pm @@ -1656,7 +1656,7 @@ sub formatIcon { foreach my $line (split(/[\n\r]+/, $text)) { # sample line: # | %ICON{help}% | =%ICON{help}%=, =%H%= | Help | gif | 16x16 | info | - if( $line =~ / %ICON{[ "']*([^ "'}]+)[^\|]*\|[^\|]*\| *(.*?) *\| *(.*?) *\| *([0-9]+)x([0-9]+)([^\|]*\| *(.*?) *\|)?/ ) { + if( $line =~ / %ICON\{[ "']*([^ "'}]+)[^\|]*\|[^\|]*\| *(.*?) *\| *(.*?) *\| *([0-9]+)x([0-9]+)([^\|]*\| *(.*?) *\|)?/ ) { my $name = $1; $this->{_ICONDATA}->{$name} = { name => $name, @@ -3391,7 +3391,7 @@ sub _processTags { # way to do this without a full parse that takes % signs # in tag parameters into account. if ( $stackTop =~ /}$/s ) { - while ( scalar( @stack) && $stackTop !~ /^%($regex{tagNameRegex}){.*}$/so ) { + while ( scalar( @stack) && $stackTop !~ /^%($regex{tagNameRegex})\{.*}$/so ) { my $top = $stackTop; #print STDERR ' ' x $tell,"COLLAPSE $top \n"; $stackTop = pop( @stack ) . $top; @@ -3519,7 +3519,7 @@ sub _expandTagOnTopicRendering { } # In parameterized variables, expand %ALL_UNUSED_TAGS{ default="..." }% to defaults # FIXME: Quick hack; do proper variable parsing - $e =~ s/%($regex{tagNameRegex}){ *default="(.*?[^\\]?)" *}%/_unescapeQuotes( $2 )/ge; + $e =~ s/%($regex{tagNameRegex})\{ *default="(.*?[^\\]?)" *}%/_unescapeQuotes( $2 )/ge; } else { $e = $this->{SESSION_TAGS}{$tag} unless( $args ); @@ -4928,7 +4928,7 @@ sub URLPARAM { $value = '' unless defined $value; } # Block expansion of %URLPARAM in the value to prevent recursion - $value =~ s/%URLPARAM{/%URLPARAM{/g; + $value =~ s/%URLPARAM\{/%URLPARAM{/g; return $value; } diff --git a/lib/TWiki/Compatibility.pm b/lib/TWiki/Compatibility.pm index 5a9d5d6..190a423 100644 --- a/lib/TWiki/Compatibility.pm +++ b/lib/TWiki/Compatibility.pm @@ -284,7 +284,7 @@ sub migrateToFileAttachmentMacro { my $line = ''; require TWiki::Attrs; foreach $line ( split( /\r?\n/, $atext ) ) { - if( $line =~ /%FILEATTACHMENT{\s"([^"]*)"([^}]*)}%/ ) { + if( $line =~ /%FILEATTACHMENT\{\s"([^"]*)"([^}]*)}%/ ) { my $name = $1; my $values = new TWiki::Attrs( $2 ); $values->{name} = $name; diff --git a/lib/TWiki/Configure/Load.pm b/lib/TWiki/Configure/Load.pm index 9b1c2fd..08586cd 100644 --- a/lib/TWiki/Configure/Load.pm +++ b/lib/TWiki/Configure/Load.pm @@ -108,7 +108,7 @@ sub expand { if (ref($_) eq 'HASH') { expand(\%$_); } else { - s/(\$TWiki::cfg{[A-Za-z0-9{}]+})/eval $1||'undef'/ge; + s/(\$TWiki::cfg\{[A-Za-z0-9{}]+})/eval $1||'undef'/ge; } } } @@ -128,7 +128,7 @@ know whether you would want that. The replacement is done in-place, =cut sub expandValue { - $_[0] =~ s/(\$TWiki::cfg{[A-Za-z0-9{}]+})/eval $1||'undef'/ge; + $_[0] =~ s/(\$TWiki::cfg\{[A-Za-z0-9{}]+})/eval $1||'undef'/ge; } =pod diff --git a/lib/TWiki/Configure/UI.pm b/lib/TWiki/Configure/UI.pm index 5a54c7d..591cd32 100644 --- a/lib/TWiki/Configure/UI.pm +++ b/lib/TWiki/Configure/UI.pm @@ -97,7 +97,7 @@ sub loadUI { sub loadChecker { my ($keys, $item) = @_; my $id = $keys; - $id =~ s/}{/::/g; + $id =~ s/}\{/::/g; $id =~ s/[}{]//g; $id =~ s/'//g; $id =~ s/-/_/g; diff --git a/lib/TWiki/Plugins/TagMePlugin.pm b/lib/TWiki/Plugins/TagMePlugin.pm index 01c5bf9..769aca1 100644 --- a/lib/TWiki/Plugins/TagMePlugin.pm +++ b/lib/TWiki/Plugins/TagMePlugin.pm @@ -2024,7 +2024,7 @@ sub _handleMakeText { # very crude hack to remove MAKETEXT{"...."} # Note: parameters are _not_ supported! - $_[0] =~ s/[%]MAKETEXT{ *\"(.*?)." *}%/$1/go; + $_[0] =~ s/[%]MAKETEXT\{ *\"(.*?)." *}%/$1/go; } # ========================= diff --git a/lib/TWiki/Render.pm b/lib/TWiki/Render.pm index 8606042..49df3a6 100644 --- a/lib/TWiki/Render.pm +++ b/lib/TWiki/Render.pm @@ -1706,7 +1706,7 @@ sub TML2PlainText { } if( $opts =~ /expandvar/ ) { - $text =~ s/(\%)(SEARCH){/$1$2/g; # prevent recursion + $text =~ s/(\%)(SEARCH)\{/$1$2/g; # prevent recursion $text = $this->{session}->handleCommonTags( $text, $web, $topic ); } else { $text =~ s/%WEB%/$web/g; @@ -1718,7 +1718,7 @@ sub TML2PlainText { $text =~ s/(})%/$1/g; # ... }% } else { # Remove %MAKETEXT{"..."}% but preserve text: - $text =~ s/%MAKETEXT{ *"?([^"}]*).*?}%/$1/go; # FIXME: Properly resolve params + $text =~ s/%MAKETEXT\{ *"?([^"}]*).*?}%/$1/go; # FIXME: Properly resolve params # Remove nested %VAR1{ ... %VAR2{...}% ...}% by # first adding nesting level to parenthesis, # e.g. "%A{%B{...}%}% ... %C{%D{...}%}%" diff --git a/lib/TWiki/Search.pm b/lib/TWiki/Search.pm index 7e4901c..2f159c5 100644 --- a/lib/TWiki/Search.pm +++ b/lib/TWiki/Search.pm @@ -556,7 +556,7 @@ sub searchWeb { # SMELL: the only META tags in a template will be METASEARCH # Why the heck are they being filtered???? - $tmpl =~ s/\%META{.*?}\%//go; # remove %META{'parent'}% + $tmpl =~ s/\%META\{.*?}\%//go; # remove %META{'parent'}% # Split template into 5 sections my ( $tmplHead, $tmplSearch, $tmplTable, $tmplNumber, $tmplTail ) = @@ -922,7 +922,7 @@ sub searchWeb { } if ( $topic eq $session->{topicName} ) { # defuse SEARCH in current topic to prevent loop - $text =~ s/%SEARCH{.*?}%/SEARCH{...}/go; + $text =~ s/%SEARCH\{.*?}%/SEARCH{...}/go; } my $textInserted; if ( $textArgs =~ /\bencode:(\w+)/ ) { diff --git a/lib/TWiki/Store.pm b/lib/TWiki/Store.pm index cc758fa..e81a6a0 100644 --- a/lib/TWiki/Store.pm +++ b/lib/TWiki/Store.pm @@ -1369,9 +1369,9 @@ Test if topic exists ( $web, $topic ) = $this->{session}->normalizeWebTopicName( $web, $topic ); for you (it'd make TWiki even slower) so make sure you do so. - + =cut - + sub topicExists { my( $this, $web, $topic ) = @_; $web =~ s#\.#/#go; @@ -1405,7 +1405,7 @@ sub extractMetaData { my $format = $STORE_FORMAT_VERSION; # head meta-data - $text =~ s(^%META:TOPICINFO{(.*)}%\r?\n) + $text =~ s(^%META:TOPICINFO\{(.*)}%\r?\n) ($meta->put( 'TOPICINFO', _readKeyValues( $1 ));'')gem; my $ti = $meta->get( 'TOPICINFO' ); @@ -1421,7 +1421,7 @@ sub extractMetaData { my $endMeta = 0; - $text =~ s(^%META:([^{]+){(.*)}%\r?\n) + $text =~ s(^%META:([^{]+)\{(.*)}%\r?\n) ( $endMeta = 1; my $keys = _readKeyValues( $2, $format ); diff --git a/lib/TWiki/Store/SearchAlgorithms/Forking.pm b/lib/TWiki/Store/SearchAlgorithms/Forking.pm index 9c568e6..84e0e9a 100644 --- a/lib/TWiki/Store/SearchAlgorithms/Forking.pm +++ b/lib/TWiki/Store/SearchAlgorithms/Forking.pm @@ -51,14 +51,14 @@ sub search { } if( $options->{casesensitive} ) { - $program =~ s/%CS{(.*?)\|.*?}%/$1/g; + $program =~ s/%CS\{(.*?)\|.*?}%/$1/g; } else { - $program =~ s/%CS{.*?\|(.*?)}%/$1/g; + $program =~ s/%CS\{.*?\|(.*?)}%/$1/g; } if( $options->{files_without_match} ) { - $program =~ s/%DET{.*?\|(.*?)}%/$1/g; + $program =~ s/%DET\{.*?\|(.*?)}%/$1/g; } else { - $program =~ s/%DET{(.*?)\|.*?}%/$1/g; + $program =~ s/%DET\{(.*?)\|.*?}%/$1/g; } if ($options->{wordboundaries} ) { # Item5529: Can't use quotemeta because $searchString may be UTF8 encoded diff --git a/lib/TWiki/Templates.pm b/lib/TWiki/Templates.pm index 432ee22..d0fa1b2 100644 --- a/lib/TWiki/Templates.pm +++ b/lib/TWiki/Templates.pm @@ -106,7 +106,7 @@ sub haveTemplate { sub _expandTrivialTemplate { my( $this, $text ) = @_; - $text =~ /%TMPL\:P{(.*)}%/; + $text =~ /%TMPL\:P\{(.*)}%/; my $attrs = new TWiki::Attrs( $1 ); # Can't expand context-dependant templates return $text if ( $attrs->{context} ); @@ -181,7 +181,7 @@ sub tmplP { $val =~ s/%$p%/$params->{$p}/ge; } } - $val =~ s/%TMPL:P{(.*?)}%/$this->expandTemplate($1)/ge; + $val =~ s/%TMPL:P\{(.*?)}%/$this->expandTemplate($1)/ge; } return $val; @@ -228,12 +228,12 @@ sub readTemplate { # recursively read template file(s) my $text = _readTemplateFile( $this, $name, $skins, $web ); - while( $text =~ /%TMPL\:INCLUDE{[\s\"]*(.*?)[\"\s]*}%/s ) { - $text =~ s/%TMPL\:INCLUDE{[\s\"]*(.*?)[\"\s]*}%/_readTemplateFile( $this, $1, $skins, $web )/geo; + while( $text =~ /%TMPL\:INCLUDE\{[\s\"]*(.*?)[\"\s]*}%/s ) { + $text =~ s/%TMPL\:INCLUDE\{[\s\"]*(.*?)[\"\s]*}%/_readTemplateFile( $this, $1, $skins, $web )/geo; } # Kill comments, marked by %{ ... }% - $text =~ s/%{.*?}%//sg; + $text =~ s/%\{.*?}%//sg; if( ! ( $text =~ /%TMPL\:/s ) ) { # no template processing @@ -248,7 +248,7 @@ sub readTemplate { foreach( split( /(%TMPL\:)/, $text ) ) { if( /^(%TMPL\:)$/ ) { $delim = $1; - } elsif( ( /^DEF{[\s\"]*(.*?)[\"\s]*}%(.*)/s ) && ( $1 ) ) { + } elsif( ( /^DEF\{[\s\"]*(.*?)[\"\s]*}%(.*)/s ) && ( $1 ) ) { # handle %TMPL:DEF{key}% if( $key ) { $this->{VARS}->{$key} = $val; @@ -272,7 +272,7 @@ sub readTemplate { } # handle %TMPL:P{"..."}% recursively - $result =~ s/(%TMPL\:P{.*?}%)/_expandTrivialTemplate( $this, $1)/geo; + $result =~ s/(%TMPL\:P\{.*?}%)/_expandTrivialTemplate( $this, $1)/geo; $result =~ s|^(( {3})+)|"\t" x (length($1)/3)|geom; # leading spaces to tabs return $result; diff --git a/lib/TWiki/UI/RDiff.pm b/lib/TWiki/UI/RDiff.pm index 21c1bb6..56af615 100644 --- a/lib/TWiki/UI/RDiff.pm +++ b/lib/TWiki/UI/RDiff.pm @@ -68,9 +68,9 @@ sub _renderCellData { my( $session, $data, $web, $topic ) = @_; ASSERT($topic) if DEBUG; if ( $data ){ - $data =~ s(^%META:FIELD{(.*)}%.*$) + $data =~ s(^%META:FIELD\{(.*)}%.*$) (_renderAttrs($1,'|*FORM FIELD $title*|$name|$value|'))gem; - $data =~ s(^%META:([A-Z]+){(.*)}%$) + $data =~ s(^%META:([A-Z]+)\{(.*)}%$) ('|*META '.$1.'*|'._renderAttrs($2).'|')gem; $data = $session->handleCommonTags( $data, $web, $topic ); @@ -436,7 +436,7 @@ sub diff { my $skin = $session->getSkin(); my $tmpl = $session->templates->readTemplate( 'rdiff', $skin ); - $tmpl =~ s/\%META{.*?}\%//go; # remove %META{'parent'}% + $tmpl =~ s/\%META\{.*?}\%//go; # remove %META{'parent'}% my( $before, $difftmpl, $after, $tail) = split( /%REPEAT%/, $tmpl);