Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecation warning for left curly braces in regular expressions #140

Merged
merged 1 commit into from Jul 31, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/MojoMojo/Declaw.pm
Expand Up @@ -139,7 +139,7 @@ my $Executables =
. '|vbs?|vbe|hta|shb|shs|hlp|chm|eml|wsf|wsh|js'
. '|asx|wm.|mdb|mht|msi|msp|cpl|lib|reg))';
my $SrcBanStd =
qr/^([A-Za-z]*script|.*\&{|mocha|about|opera|mailto:|hcp:|\/(dev|proc)|\\|file|smb|cid:${Executables}(@|\?|$))/i;
qr/^([A-Za-z]*script|.*\&\{|mocha|about|opera|mailto:|hcp:|\/(dev|proc)|\\|file|smb|cid:${Executables}(@|\?|$))/i;

my %Rules = (

Expand All @@ -162,7 +162,7 @@ my %Rules = (
"frame" => qr/^(void|above|below|hsides|vsides|lhs|rhs|box|border)$/i,

# href: Not javascript, vbs or vbscript
"href" => qr/^([A-Za-z]*script|.*\&{|mocha|hcp|opera|about|smb|\/dev\/)/i,
"href" => qr/^([A-Za-z]*script|.*\&\{|mocha|hcp|opera|about|smb|\/dev\/)/i,
"usemap-href" => qr/^#[A-Za-z0-9_.-]+$/, # this is not really a href at all!
"input-size" =>
qr/^(\d{1,4})$/, # some browsers freak out with very large widgets
Expand Down Expand Up @@ -199,7 +199,7 @@ qr/^(none,a,i,upper-alpha,lower-alpha,upper-roman,lower-roman,decimal,disc,squar
"style" => qr/^.*$/s,

#kc In addition to this, we could strip all 'javascript:|expression|' etc. from all attributes(in attribute_cleanup())
"stylesheet" => qr/expression|eval|script:|mocha:|\&{|\@import/i
"stylesheet" => qr/expression|eval|script:|mocha:|\&\{|\@import/i
, # stylesheets are forbidden if Embedded => 1. css positioning can be allowed in an iframe.
# NB see also `process_stylesheet' below
"style-type" => qr/script|mocha/i,
Expand Down
2 changes: 1 addition & 1 deletion lib/MojoMojo/Formatter.pm
Expand Up @@ -105,7 +105,7 @@ Returns a regular expression for the given tag between matching double braces.
sub gen_re {
my ($self, $tag, $args)=@_;
$args ||= '';
return qr[{{\s*$tag\s*$args\s*}}];
return qr[\{\{\s*$tag\s*$args\s*}}];
}


Expand Down
2 changes: 1 addition & 1 deletion lib/MojoMojo/Formatter/CPANHyperlink.pm
Expand Up @@ -62,7 +62,7 @@ sub format_content {
my $section = qr[ .*? (?= \s* /? }} ) ]x;

$$content =~ s[
{{cpan \s+ ($cpan_module) (?: / ($section))? \s* \/? }}
\{\{cpan \s+ ($cpan_module) (?: / ($section))? \s* \/? }}
] [
my ($module, $section) = ($1, $2);
if (defined $section) {
Expand Down
2 changes: 1 addition & 1 deletion lib/MojoMojo/Formatter/Dir.pm
Expand Up @@ -59,7 +59,7 @@ sub format_content {
$$content = "";
foreach my $line (@lines) {

if ( $line =~ m|<p>{{dir\s*(\S*)\s*(\S*)}}</p>| ) {
if ( $line =~ m|<p>\{\{dir\s*(\S*)\s*(\S*)}}</p>| ) {
my $dir = $1;
my $exclude = $2;

Expand Down
2 changes: 1 addition & 1 deletion lib/MojoMojo/Formatter/File.pm
Expand Up @@ -97,7 +97,7 @@ sub format_content {
my $is_image = 0;
foreach my $line (@lines) {

if ( $line =~ m|{{\s*file\s*(\w+)\s*(.*)}}.*| ) {
if ( $line =~ m|\{\{\s*file\s*(\w+)\s*(.*)}}.*| ) {
my $plugin=$1; # DocBook, Pod, ...
my $file=$2; # File, Attachment

Expand Down
2 changes: 1 addition & 1 deletion lib/MojoMojo/Formatter/TOC.pm
Expand Up @@ -65,7 +65,7 @@ sub format_content {
while (
# replace the {{toc ..}} markup tag and parse potential parameters
$$content =~ s[
{{ toc (?:$toc_params_RE)? \s* \/? }}
\{\{ toc (?:$toc_params_RE)? \s* \/? }}
][<div class="toc">\n<!--mojomojoTOCwillgohere-->\n</div>]ix) {
my ($toc_h_min, $toc_h_max);
$toc_h_min = $1 || 1;
Expand Down
2 changes: 1 addition & 1 deletion t/formatter_file.t
Expand Up @@ -72,7 +72,7 @@ like($$ret, qr|Can not read 't/var/files//bla.txt' !|s, "Can not read file");
# format with no plugin
$content = '<p>{{file $dir/test.txt}}</p>';
$ret = MojoMojo::Formatter::File->format_content(\$content, $c);
like($$ret, qr/{{file \$dir\/test.txt}}/s, "No plugin is provided");
like($$ret, qr/\{\{file \$dir\/test.txt}}/s, "No plugin is provided");


# Check bad plugin
Expand Down
2 changes: 1 addition & 1 deletion t/formatter_rss.t
Expand Up @@ -17,7 +17,7 @@ BEGIN {
my $fake_c = FakeCatalystObject->new;
my ($content);

content_like '/.jsrpc/render?content=%7B%7Bhttp://localhost/.rss%7D%7D', qr'{{http://localhost/.rss}}',
content_like '/.jsrpc/render?content=%7B%7Bhttp://localhost/.rss%7D%7D', qr'\{\{http://localhost/.rss}}',
'invalidate the old "syntax"';

SKIP: {
Expand Down