[interchange-cvs] interchange - racke modified lib/Vend/Interpolate.pm
interchange-core@interchange.redhat.com
interchange-core@interchange.redhat.com
Thu Jan 31 19:19:00 2002
User: racke
Date: 2002-02-01 00:18:07 GMT
Modified: lib/Vend Interpolate.pm
Log:
next try for a proper escaping, this works for me in all these cases:
loop search="..."
area href=scan arg="... li=%Pants ..."
area href="Catalog/Pants/Long Ones"
i didn't if there are any issues with formlink, which calls escape_mv
Revision Changes Path
2.49 +12 -7 interchange/lib/Vend/Interpolate.pm
rev 2.49, prev_rev 2.48
Index: Interpolate.pm
===================================================================
RCS file: /anon_cvs/repository/interchange/lib/Vend/Interpolate.pm,v
retrieving revision 2.48
retrieving revision 2.49
diff -u -r2.48 -r2.49
--- Interpolate.pm 31 Jan 2002 20:26:18 -0000 2.48
+++ Interpolate.pm 1 Feb 2002 00:18:07 -0000 2.49
@@ -1,6 +1,6 @@
# Vend::Interpolate - Interpret Interchange tags
#
-# $Id: Interpolate.pm,v 2.48 2002/01/31 20:26:18 mheins Exp $
+# $Id: Interpolate.pm,v 2.49 2002/02/01 00:18:07 racke Exp $
#
# Copyright (C) 1996-2001 Red Hat, Inc. <interchange@redhat.com>
#
@@ -27,7 +27,7 @@
require Exporter;
@ISA = qw(Exporter);
-$VERSION = substr(q$Revision: 2.48 $, 10);
+$VERSION = substr(q$Revision: 2.49 $, 10);
@EXPORT = qw (
@@ -3349,7 +3349,7 @@
# Escapes a scan reliably in three different possible ways
sub escape_scan {
- my ($scan, $ref) = @_;
+ my ($scan, $ref, $esc) = @_;
#::logDebug("escape_scan: scan=$scan");
if (ref $scan) {
for(@$scan) {
@@ -3381,11 +3381,11 @@
}
}
- return join '/', 'scan', escape_mv('/', $scan);
+ return join '/', 'scan', escape_mv('/', $scan, undef, $esc);
}
sub escape_mv {
- my ($joiner, $scan, $not_scan) = @_;
+ my ($joiner, $scan, $not_scan, $esc) = @_;
my @args;
@@ -3405,8 +3405,13 @@
for(@args) {
s!/!__SLASH__!g unless defined $not_scan;
s!\0!-_NULL_-!g;
- m!\w=!
- or (undef $_, next);
+ if ($esc) {
+ s!(\w\w=)(.*)!$1 . esc($2)!eg
+ or (undef $_, next);
+ } else {
+ m!\w=!
+ or (undef $_, next);
+ }
s!__SLASH__!::!g unless defined $not_scan;
}
return join $joiner, grep(defined $_, @args);