[interchange-cvs] interchange - racke modified lib/Vend/Parse.pm

interchange-core@icdevgroup.org interchange-core@icdevgroup.org
Tue Mar 18 06:33:01 2003


User:      racke
Date:      2003-03-18 11:32:24 GMT
Modified:  lib/Vend Parse.pm
Log:
this patch allows the usage of full-fledged UserTag aliases
any aspect of the actual usertag like endtag and interpolate should be
reflected in the alias as well, needed for alias L => loc and makes
sense IMHO anyway
special aliases like process_search should still be working
I didn't tried the weird thingy 'buzzard' though

Revision  Changes    Path
2.25      +13 -5     interchange/lib/Vend/Parse.pm


rev 2.25, prev_rev 2.24
Index: Parse.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Parse.pm,v
retrieving revision 2.24
retrieving revision 2.25
diff -u -r2.24 -r2.25
--- Parse.pm	14 Jan 2003 02:25:53 -0000	2.24
+++ Parse.pm	18 Mar 2003 11:32:24 -0000	2.25
@@ -1,6 +1,6 @@
 # Vend::Parse - Parse Interchange tags
 # 
-# $Id: Parse.pm,v 2.24 2003/01/14 02:25:53 mheins Exp $
+# $Id: Parse.pm,v 2.25 2003/03/18 11:32:24 racke Exp $
 #
 # Copyright (C) 1996-2002 Red Hat, Inc. <interchange@redhat.com>
 #
@@ -35,7 +35,7 @@
 
 @ISA = qw(Exporter Vend::Parser);
 
-$VERSION = substr(q$Revision: 2.24 $, 10);
+$VERSION = substr(q$Revision: 2.25 $, 10);
 
 @EXPORT = ();
 @EXPORT_OK = qw(find_matching_end);
@@ -624,15 +624,23 @@
 	}
 
     # $attr is reference to a HASH, $attrseq is reference to an ARRAY
+	my $aliasname = '';
 	unless (defined $Routine{$tag}) {
 		if(defined $Alias{$tag}) {
+			$aliasname = $tag;
 			my $alias = $Alias{$tag};
 			$tag =~ s/_/[-_]/g;
 #::logDebug("origtext: $origtext tag=$tag alias=$alias");
 			$origtext =~ s/$tag/$alias/i
 				or return 0;
-			$$buf = $origtext . $$buf;
-			return 1;
+			if ($alias =~ /\s/) {
+				# keep old behaviour for aliases like
+				# process_search => 'area href=search'
+				# otherwise we process it like any other tag
+				$$buf = $origtext . $$buf;
+				return 1;
+			}
+			$tag = $alias;
 		}
 		else {
 #::logDebug("no alias. origtext: $origtext");
@@ -755,7 +763,7 @@
 		# Handle embedded tags, but only if interpolate is 
 		# defined (always if using old tags)
 #::logDebug("look end for $tag, buf=" . length($$buf) );
-		$tmpbuf = $empty_container ? '' : find_matching_end($tag, $buf);
+		$tmpbuf = $empty_container ? '' : find_matching_end($aliasname || $tag, $buf);
 #::logDebug("FOUND end for $tag\nBuf " . length($$buf) . ":\n" . $$buf . "\nTmpbuf:\n$tmpbuf\n");
 		if ($attr->{interpolate} and !$empty_container) {
 			my $p = new Vend::Parse;