fix generator.vembed()
authorTony Cook <tony@develop-help.com>
Wed, 16 Dec 2015 08:00:29 +0000 (19:00 +1100)
committerTony Cook <tony@develop-help.com>
Wed, 16 Dec 2015 08:00:29 +0000 (19:00 +1100)
MANIFEST
site/cgi-bin/modules/BSE/Generate.pm
site/templates/test/title.tmpl [new file with mode: 0644]
t/060-generate/020-catalog.t

index 2b2dc3c..025bd51 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -803,6 +803,7 @@ site/templates/tellafriend/email.tmpl
 site/templates/tellafriend/email_html.tmpl
 site/templates/test/children.tmpl
 site/templates/test/testrep.tmpl
+site/templates/test/title.tmpl
 site/templates/textemail/basic.tmpl
 site/templates/user/admin_book_seminar.tmpl
 site/templates/user/admin_edit_seminar.tmpl
index db7f03d..a054b6d 100644 (file)
@@ -313,7 +313,7 @@ Conditional tag, true if the current article is being embedded.
 
 =cut
 
-our $VERSION = "1.026";
+our $VERSION = "1.027";
 
 my $excerptSize = 300;
 
@@ -689,9 +689,12 @@ specified template.
 
 
 sub vembed {
-  my ($self, $article, $template) = @_;
+  my ($self, $article, $template, $maxdepth) = @_;
 
-  return $self->embed($article, "BSE::TB::Articles", $template);
+  $maxdepth = $self->{maxdepth} 
+    if !$maxdepth || $maxdepth > $self->{maxdepth};
+
+  return $self->_embed_low($article, "BSE::TB::Articles", $template, $maxdepth);
 }
 
 sub iter_kids_of {
diff --git a/site/templates/test/title.tmpl b/site/templates/test/title.tmpl
new file mode 100644 (file)
index 0000000..231082f
--- /dev/null
@@ -0,0 +1 @@
+<:= article.title :>
\ No newline at end of file
index ed56fbc..4543db8 100644 (file)
@@ -1,7 +1,7 @@
 #!perl -w
 use strict;
 use BSE::Test ();
-use Test::More tests=>83;
+use Test::More tests=>86;
 use File::Spec;
 use FindBin;
 BEGIN {
@@ -275,6 +275,12 @@ TEMPLATE
 Test catalog
 EXPECTED
 
+template_test "vembed", $prods[0], <<TEMPLATE, <<EXPECTED;
+<:= generator.vembed(article.parent, "test/title.tmpl") |raw:>
+TEMPLATE
+Test catalog
+EXPECTED
+
 BSE::Admin::StepParents->del($parent, $stepkid);
 BSE::Admin::StepParents->del($parent, $stepprod);
 for my $kid (reverse @prods, $stepprod) {