]> git.imager.perl.org - bse.git/blobdiff - site/cgi-bin/modules/BSE/Generate.pm
fix generator.vembed()
[bse.git] / site / cgi-bin / modules / BSE / Generate.pm
index 69a2cfc27e32e4997856f06075f396c56f8be0e0..a054b6d4fb3754877e52c83888983a2c93544e50 100644 (file)
@@ -313,7 +313,7 @@ Conditional tag, true if the current article is being embedded.
 
 =cut
 
-our $VERSION = "1.025";
+our $VERSION = "1.027";
 
 my $excerptSize = 300;
 
@@ -471,7 +471,7 @@ sub _make_html {
   return unescape_html($_[0]);
 }
 
-sub _embed_low {
+sub _embed_tag {
   my ($self, $acts, $articles, $what, $template, $maxdepth, $templater) = @_;
 
   $maxdepth = $self->{maxdepth} 
@@ -513,6 +513,12 @@ sub _embed_low {
       or return "** Cannot find article $id to be embedded **";;
   }
 
+  return $self->_embed_low($embed, $articles, $template, $maxdepth);
+}
+
+sub _embed_low {
+  my ($self, $embed, $articles, $template, $maxdepth) = @_;
+
   my $gen = $self;
   if (ref($self) ne $embed->{generator}) {
     my $genname = $embed->{generator};
@@ -683,9 +689,12 @@ specified template.
 
 
 sub vembed {
-  my ($self, $article, $template) = @_;
+  my ($self, $article, $template, $maxdepth) = @_;
+
+  $maxdepth = $self->{maxdepth} 
+    if !$maxdepth || $maxdepth > $self->{maxdepth};
 
-  return $self->embed($article, "BSE::TB::Articles", $template);
+  return $self->_embed_low($article, "BSE::TB::Articles", $template, $maxdepth);
 }
 
 sub iter_kids_of {
@@ -1180,7 +1189,7 @@ sub baseActs {
        return '' if $args eq 'start' || $args eq 'end';
        my ($what, $template, $maxdepth) = split ' ', $args;
        undef $maxdepth if defined $maxdepth && $maxdepth !~ /^\d+/;
-       return $self->_embed_low($acts, $articles, $what, $template, $maxdepth, $templater);
+       return $self->_embed_tag($acts, $articles, $what, $template, $maxdepth, $templater);
      },
      ifCanEmbed=> sub { $self->{depth} <= $self->{maxdepth} },