[interchange] * Add MV_AUTOEND capability as in MV_AUTOLOAD -- automatically appends something

Mike Heins interchange-cvs at icdevgroup.org
Tue Mar 25 18:17:08 UTC 2014


commit bf6412f1130f4c04248a0a993b76e8db2866bb29
Author: Mike Heins <heins at icdevgroup.com>
Date:   Tue Mar 25 14:14:44 2014 -0400

    * Add MV_AUTOEND capability as in MV_AUTOLOAD -- automatically appends something
      to an IC page first time it is run through interpolate_html(). This is
      arguably more useful than MV_AUTOLOAD, which happened at the beginning.
    
    * Fix bug in init_page pragma capability. The flypage would be
      double-wrapped.

 lib/Vend/Interpolate.pm |    2 ++
 lib/Vend/Page.pm        |    6 ++++--
 2 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/lib/Vend/Interpolate.pm b/lib/Vend/Interpolate.pm
index 68653c8..b44f185 100644
--- a/lib/Vend/Interpolate.pm
+++ b/lib/Vend/Interpolate.pm
@@ -653,6 +653,8 @@ sub interpolate_html {
 	if(defined $Vend::PageInit and ! $Vend::PageInit) {
 		defined $::Variable->{MV_AUTOLOAD}
 			and $html =~ s/^/$::Variable->{MV_AUTOLOAD}/;
+		defined $::Variable->{MV_AUTOEND}
+			and $html =~ s/$/$::Variable->{MV_AUTOEND}/;
 		$toplevel = 1;
 	}
 #::logDebug("opt=" . uneval($opt));
diff --git a/lib/Vend/Page.pm b/lib/Vend/Page.pm
index 92a0d37..1a1f2a0 100644
--- a/lib/Vend/Page.pm
+++ b/lib/Vend/Page.pm
@@ -118,8 +118,10 @@ sub display_page {
 	my $inth_opt;
 	# Try for on-the-fly if not there
 	if(! defined $page) {
+		$Vend::PageInit = 0;
 		$page = Vend::Interpolate::fly_page($name)
-			and $inth_opt->{onfly} = 1;
+			and $inth_opt->{onfly} = 1
+			and undef $Vend::PageInit;
 	}
 
 	# Try one last time for page with index
@@ -130,7 +132,7 @@ sub display_page {
 	}
 
 	if (defined $page) {
-		$Vend::PageInit = 0;
+		$Vend::PageInit = 0 unless $inth_opt->{onfly};
 		if ($opt->{return}) {
 			return ::interpolate_html($page, 1, $inth_opt);
 		} else {



More information about the interchange-cvs mailing list