r17629 - in /branches/upstream/libhtml-template-pro-perl/current: ./ lib/HTML/Template/ t/ templates-Pro/

roberto at users.alioth.debian.org roberto at users.alioth.debian.org
Sun Mar 16 05:30:36 UTC 2008


Author: roberto
Date: Sun Mar 16 05:30:35 2008
New Revision: 17629

URL: http://svn.debian.org/wsvn/?sc=1&rev=17629
Log:
[svn-upgrade] Integrating new upstream version, libhtml-template-pro-perl (0.69)

Added:
    branches/upstream/libhtml-template-pro-perl/current/templates-Pro/test_if7.out
    branches/upstream/libhtml-template-pro-perl/current/templates-Pro/test_if7.tmpl
Modified:
    branches/upstream/libhtml-template-pro-perl/current/Changes
    branches/upstream/libhtml-template-pro-perl/current/MANIFEST
    branches/upstream/libhtml-template-pro-perl/current/META.yml
    branches/upstream/libhtml-template-pro-perl/current/Makefile.PL
    branches/upstream/libhtml-template-pro-perl/current/README
    branches/upstream/libhtml-template-pro-perl/current/lib/HTML/Template/Pro.pm
    branches/upstream/libhtml-template-pro-perl/current/lib/HTML/Template/SYNTAX.pod
    branches/upstream/libhtml-template-pro-perl/current/perl-HTML-Template-Pro.spec
    branches/upstream/libhtml-template-pro-perl/current/procore.c
    branches/upstream/libhtml-template-pro-perl/current/t/HTML-Template-Pro.t
    branches/upstream/libhtml-template-pro-perl/current/tagstack.h
    branches/upstream/libhtml-template-pro-perl/current/tagstack.inc

Modified: branches/upstream/libhtml-template-pro-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libhtml-template-pro-perl/current/Changes?rev=17629&op=diff
==============================================================================
--- branches/upstream/libhtml-template-pro-perl/current/Changes (original)
+++ branches/upstream/libhtml-template-pro-perl/current/Changes Sun Mar 16 05:30:35 2008
@@ -143,3 +143,6 @@
 
 0.68  Tue Jan  8 19:59:12 EET 2008
 	- fixed Windows compilation thanks to Vyacheslav Shevelyov
+
+0.69  Thu Feb 28 06:46:17 EET 2008
+	- added elsif tag (requested by koha.org project)

Modified: branches/upstream/libhtml-template-pro-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/branches/upstream/libhtml-template-pro-perl/current/MANIFEST?rev=17629&op=diff
==============================================================================
--- branches/upstream/libhtml-template-pro-perl/current/MANIFEST (original)
+++ branches/upstream/libhtml-template-pro-perl/current/MANIFEST Sun Mar 16 05:30:35 2008
@@ -98,6 +98,8 @@
 templates-Pro/test_if5.tmpl
 templates-Pro/test_if6.out
 templates-Pro/test_if6.tmpl
+templates-Pro/test_if7.out
+templates-Pro/test_if7.tmpl
 templates-Pro/test_include1.out
 templates-Pro/test_include1.tmpl
 templates-Pro/test_include2.out

Modified: branches/upstream/libhtml-template-pro-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libhtml-template-pro-perl/current/META.yml?rev=17629&op=diff
==============================================================================
--- branches/upstream/libhtml-template-pro-perl/current/META.yml (original)
+++ branches/upstream/libhtml-template-pro-perl/current/META.yml Sun Mar 16 05:30:35 2008
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:                HTML-Template-Pro
-version:             0.68
+version:             0.69
 abstract:            Perl/XS module to use HTML Templates from CGI scripts
 license:             ~
 generated_by:        ExtUtils::MakeMaker version 6.32

Modified: branches/upstream/libhtml-template-pro-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/branches/upstream/libhtml-template-pro-perl/current/Makefile.PL?rev=17629&op=diff
==============================================================================
--- branches/upstream/libhtml-template-pro-perl/current/Makefile.PL (original)
+++ branches/upstream/libhtml-template-pro-perl/current/Makefile.PL Sun Mar 16 05:30:35 2008
@@ -147,7 +147,7 @@
 	echo '</pre></body></html>' >> $@
 
 TARBALL=HTML-Template-Pro-$(VERSION).tar.gz
-SF_HOME='viy2 at html-tmpl-pro.sf.net:~/www-html-tmpl-pro/htdocs'
+SF_HOME='viy2 at html-tmpl-pro.sf.net:/home/groups/h/ht/html-tmpl-pro/htdocs/'
 sourceforge: tardist index.html
 	( echo 'anonymous';	\
 	  echo prompt;		\

Modified: branches/upstream/libhtml-template-pro-perl/current/README
URL: http://svn.debian.org/wsvn/branches/upstream/libhtml-template-pro-perl/current/README?rev=17629&op=diff
==============================================================================
--- branches/upstream/libhtml-template-pro-perl/current/README (original)
+++ branches/upstream/libhtml-template-pro-perl/current/README Sun Mar 16 05:30:35 2008
@@ -1,4 +1,4 @@
-HTML-Template-Pro version 0.67
+HTML-Template-Pro version 0.69
 ==============================
 
 DESCRIPTION
@@ -91,9 +91,9 @@
 
 COPYRIGHT AND LICENCE
 
-Copyright (C) 2005 by I. Yu. Vlasenko.
+Copyright (C) 2005-2008 by I. Yu. Vlasenko.
 Pieces of code in Pro.pm and documentation of HTML::Template are
-copyright (C) 2000-2002 Sam Tregar (sam at tregar.com)
+copyright (C) 2000-2006 Sam Tregar (sam at tregar.com)
 
 The template syntax, interface conventions and a large piece of documentation 
 of HTML::Template::Pro are based on CPAN module HTML::Template 
@@ -101,4 +101,8 @@
 
 This library is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself, either Perl version 5.8.4 or,
-at your option, any later version of Perl 5 you may have available.
+at your option, any later version of Perl 5 you may have available,
+or, at your option, under the terms of the GNU General Public License 
+as published by the Free Software Foundation; either version 2 of the 
+License, or (at your option) any later version.
+

Modified: branches/upstream/libhtml-template-pro-perl/current/lib/HTML/Template/Pro.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libhtml-template-pro-perl/current/lib/HTML/Template/Pro.pm?rev=17629&op=diff
==============================================================================
--- branches/upstream/libhtml-template-pro-perl/current/lib/HTML/Template/Pro.pm (original)
+++ branches/upstream/libhtml-template-pro-perl/current/lib/HTML/Template/Pro.pm Sun Mar 16 05:30:35 2008
@@ -9,7 +9,7 @@
 use vars qw($VERSION @ISA);
 @ISA = qw(DynaLoader);
 
-$VERSION = '0.68';
+$VERSION = '0.69';
 
 bootstrap HTML::Template::Pro $VERSION;
 

Modified: branches/upstream/libhtml-template-pro-perl/current/lib/HTML/Template/SYNTAX.pod
URL: http://svn.debian.org/wsvn/branches/upstream/libhtml-template-pro-perl/current/lib/HTML/Template/SYNTAX.pod?rev=17629&op=diff
==============================================================================
--- branches/upstream/libhtml-template-pro-perl/current/lib/HTML/Template/SYNTAX.pod (original)
+++ branches/upstream/libhtml-template-pro-perl/current/lib/HTML/Template/SYNTAX.pod Sun Mar 16 05:30:35 2008
@@ -48,6 +48,7 @@
 This module attempts to make using HTML templates simple and natural.
 It extends standard HTML with a few new HTML-esque tags - <TMPL_VAR>,
 <TMPL_LOOP>, <TMPL_INCLUDE>, <TMPL_IF>, <TMPL_ELSE> and <TMPL_UNLESS>.
+(HTML::Template::Pro also supports <TMPL_ELSIF> tag.)
 The file written with HTML and these new tags is called a template.
 It is usually saved separate from your script - possibly even created
 by someone else!  Using this module you fill in the values for the
@@ -323,7 +324,19 @@
 practice of only using TMPL_IF if you can do so without requiring a
 matching if() in your Perl code.
 
+=head2 TMPL_ELSIF
+
+
+  <TMPL_IF NAME="PARAMETER_NAME1"> ... 
+  <TMPL_ELSIF NAME="PARAMETER_NAME2"> ... 
+  <TMPL_ELSIF NAME="PARAMETER_NAME3"> ... 
+  <TMPL_ELSE> ... </TMPL_IF>
+
+WARNING: TMPL_ELSIF is a HTML::Template::Pro extension! It is 
+not supported in HTML::Template (as of 2.9). 
+
 =head2 TMPL_ELSE
+
 
   <TMPL_IF NAME="PARAMETER_NAME"> ... <TMPL_ELSE> ... </TMPL_IF>
 

Modified: branches/upstream/libhtml-template-pro-perl/current/perl-HTML-Template-Pro.spec
URL: http://svn.debian.org/wsvn/branches/upstream/libhtml-template-pro-perl/current/perl-HTML-Template-Pro.spec?rev=17629&op=diff
==============================================================================
--- branches/upstream/libhtml-template-pro-perl/current/perl-HTML-Template-Pro.spec (original)
+++ branches/upstream/libhtml-template-pro-perl/current/perl-HTML-Template-Pro.spec Sun Mar 16 05:30:35 2008
@@ -6,8 +6,8 @@
 %define module HTML-Template-Pro
 
 Name: perl-%module
-Version: 0.68
-Release: alt2
+Version: 0.69
+Release: alt1
 
 Packager: Igor Yu. Vlasenko <viy at altlinux.org>
 
@@ -54,6 +54,9 @@
 %perl_vendor_man3dir/*
 
 %changelog
+* Thu Feb 28 2008 Igor Vlasenko <viy at altlinux.ru> 0.69-alt1
+- new version; see Changes
+
 * Tue Jan 08 2008 Igor Vlasenko <viy at altlinux.ru> 0.68-alt2
 - fix for ix86
 

Modified: branches/upstream/libhtml-template-pro-perl/current/procore.c
URL: http://svn.debian.org/wsvn/branches/upstream/libhtml-template-pro-perl/current/procore.c?rev=17629&op=diff
==============================================================================
--- branches/upstream/libhtml-template-pro-perl/current/procore.c (original)
+++ branches/upstream/libhtml-template-pro-perl/current/procore.c Sun Mar 16 05:30:35 2008
@@ -21,7 +21,8 @@
 #define HTML_TEMPLATE_TAG_IF      4
 #define HTML_TEMPLATE_TAG_ELSE    5
 #define HTML_TEMPLATE_TAG_UNLESS  6
-#define HTML_TEMPLATE_LAST_TAG_USED  6
+#define HTML_TEMPLATE_TAG_ELSIF   7
+#define HTML_TEMPLATE_LAST_TAG_USED  7
 
 #if defined(__GNUC__) && !(defined(PEDANTIC))
 #define INLINE inline
@@ -32,13 +33,13 @@
 static 
 const char* const tagname[]={
     "Bad or unsupported tag", /* 0 */
-    "var", "include", "loop", "if", "else", "unless"
+    "var", "include", "loop", "if", "else", "unless", "elsif"
 };
 
 static 
 const char* const TAGNAME[]={
     "Bad or unsupported tag", /* 0 */
-    "VAR", "INCLUDE", "LOOP", "IF", "ELSE", "UNLESS"
+    "VAR", "INCLUDE", "LOOP", "IF", "ELSE", "UNLESS", "ELSIF"
 };
 
 /* max offset to ensure we are not out of file when try <!--/  */
@@ -435,7 +436,7 @@
 int
 test_stack (int tag)
 {
-  //  return (tagstack_notempty(&(state->tag_stack)) && (tagstack_head(&(state->tag_stack))->tag==tag));
+  //  return (tagstack_notempty(&(state->tag_stack)) && (tagstack_top(&(state->tag_stack))->tag==tag));
   return 1;
 }
 
@@ -445,9 +446,9 @@
 {
   if (stack_tag_type) {
     if (tagstack_notempty(&(state->tag_stack))) {
-      struct tagstack_entry iftag=tagstack_top(&(state->tag_stack));
-      if (iftag.tag!=stack_tag_type) {
-	tmpl_log(state,TMPL_LOG_ERROR, "ERROR: tag mismatch with %s\n",TAGNAME[iftag.tag]);
+      struct tagstack_entry* iftag=tagstack_top(&(state->tag_stack));
+      if (iftag->tag!=stack_tag_type) {
+	tmpl_log(state,TMPL_LOG_ERROR, "ERROR: tag mismatch with %s\n",TAGNAME[iftag->tag]);
       }
     } else {
       tmpl_log(state,TMPL_LOG_ERROR, "ERROR: opening tag %s not found\n",TAGNAME[stack_tag_type]);
@@ -487,7 +488,7 @@
 void 
 tag_handler_else (struct tmplpro_state *state)
 {
-  struct tagstack_entry iftag;
+  struct tagstack_entry* iftag;
   if (! test_stack(HTML_TEMPLATE_TAG_IF) && 
       ! test_stack(HTML_TEMPLATE_TAG_UNLESS)) {
     tag_stack_debug(state,HTML_TEMPLATE_TAG_ELSE);
@@ -495,12 +496,40 @@
   }
   iftag=tagstack_top(&(state->tag_stack));
   if (0==state->is_visible) state->last_processed_pos=state->cur_pos;
-  if (iftag.value) {
+  if (iftag->value) {
     state->is_visible=0;
-  } else if (1==iftag.vcontext) {
+  } else if (1==iftag->vcontext) {
     state->is_visible=1;
   }
-  if (debuglevel>3) tmpl_log(state,TMPL_LOG_DEBUG2,"else:(pos %td) visible:context =%d, set to %d ",iftag.position - state->top,iftag.vcontext,state->is_visible);
+  if (debuglevel>3) tmpl_log(state,TMPL_LOG_DEBUG2,"else:(pos %td) visible:context =%d, set to %d ",iftag->position - state->top,iftag->vcontext,state->is_visible);
+}
+
+static 
+void 
+tag_handler_elsif (struct tmplpro_state *state, PSTRING name)
+{
+  struct tagstack_entry *iftag;
+  if (! test_stack(HTML_TEMPLATE_TAG_IF) && 
+      ! test_stack(HTML_TEMPLATE_TAG_UNLESS)) {
+    tag_stack_debug(state,HTML_TEMPLATE_TAG_ELSIF);
+    return;
+  }
+  iftag=tagstack_top(&(state->tag_stack));
+  if (0==state->is_visible) state->last_processed_pos=state->cur_pos;
+  if (iftag->value) {
+    state->is_visible=0;
+  } else if (1==iftag->vcontext) {
+    /* test only if vcontext==true; if the whole tag if..endif itself is invisible, skip the is_var_true test */
+    /*TODO: it is reasonable to skip is_var_true test in if/unless too */
+    if (is_var_true(state,name)) {
+      iftag->value=1;
+      state->is_visible=1;
+    } else {
+      iftag->value=0;
+      state->is_visible=0;
+    }
+  }
+  if (debuglevel>3) tmpl_log(state,TMPL_LOG_DEBUG2,"elsif:(pos %td) visible:context =%d, set to %d ",iftag->position - state->top,iftag->vcontext,state->is_visible);
 }
 
 static 
@@ -544,19 +573,20 @@
 void 
 tag_handler_closeloop (struct tmplpro_state *state)
 {
-  struct tagstack_entry iftag;
+  struct tagstack_entry* iftag_ptr;
   if (! test_stack(HTML_TEMPLATE_TAG_LOOP)) {
     tag_stack_debug(state,HTML_TEMPLATE_TAG_LOOP);
     return;
   }
-  iftag=tagstack_top(&(state->tag_stack));
-  if (iftag.value==1 && next_loop(state)) {
+  iftag_ptr=tagstack_top(&(state->tag_stack));
+  if (iftag_ptr->value==1 && next_loop(state)) {
     /* continue loop */
-    state->cur_pos=iftag.position;
-    state->last_processed_pos=iftag.position;
+    state->cur_pos=iftag_ptr->position;
+    state->last_processed_pos=iftag_ptr->position;
     return;
   } else {
     /* finish loop */
+    struct tagstack_entry iftag;
     iftag=tagstack_pop(&(state->tag_stack));
     state->is_visible=iftag.vcontext;
     state->last_processed_pos=state->cur_pos;
@@ -800,6 +830,7 @@
     case HTML_TEMPLATE_TAG_IF:	tag_handler_if(state,OptName);	break;
     case HTML_TEMPLATE_TAG_UNLESS:	tag_handler_unless(state,OptName);break;
     case HTML_TEMPLATE_TAG_ELSE:	tag_handler_else(state);	break;
+    case HTML_TEMPLATE_TAG_ELSIF:	tag_handler_elsif(state,OptName);break;
     case HTML_TEMPLATE_TAG_LOOP:	tag_handler_loop(state,OptName);break;
     case HTML_TEMPLATE_TAG_INCLUDE:	tag_handler_include(state,OptName,OptDefault);break;
     default:	tag_handler_unknown(state);break;

Modified: branches/upstream/libhtml-template-pro-perl/current/t/HTML-Template-Pro.t
URL: http://svn.debian.org/wsvn/branches/upstream/libhtml-template-pro-perl/current/t/HTML-Template-Pro.t?rev=17629&op=diff
==============================================================================
--- branches/upstream/libhtml-template-pro-perl/current/t/HTML-Template-Pro.t (original)
+++ branches/upstream/libhtml-template-pro-perl/current/t/HTML-Template-Pro.t Sun Mar 16 05:30:35 2008
@@ -6,7 +6,7 @@
 # change 'tests => 1' to 'tests => last_test_to_print';
 
 use Test;
-BEGIN {plan tests => 1+2*(17+4) };
+BEGIN {plan tests => 1+2*(18+4) };
 use File::Spec;
 #use HTML::Template;
 use HTML::Template::Pro;
@@ -50,6 +50,7 @@
 test_tmpl('test_if3',  @refset1);
 test_tmpl('test_if4',  @varset1);
 test_tmpl('test_if5',  @varset1);
+test_tmpl('test_if7',  @varset1);
 test_tmpl('test_include1', @varset1);
 test_tmpl('test_include2', @varset1);
 test_tmpl('test_include3', @varset1);

Modified: branches/upstream/libhtml-template-pro-perl/current/tagstack.h
URL: http://svn.debian.org/wsvn/branches/upstream/libhtml-template-pro-perl/current/tagstack.h?rev=17629&op=diff
==============================================================================
--- branches/upstream/libhtml-template-pro-perl/current/tagstack.h (original)
+++ branches/upstream/libhtml-template-pro-perl/current/tagstack.h Sun Mar 16 05:30:35 2008
@@ -2,10 +2,10 @@
 #define _TAGSTACK_H	1
 
 struct tagstack_entry {
-  int tag;
-  int value;
-  int vcontext;
-  char* position;
+  int tag;		/* code of tag */
+  int value;		/* if (true/false) - used in else */
+  int vcontext;		/* visibility context of the tag (visible/unvisible) */
+  char* position;	/* start of tag; useful for loops */
 };
 
 static 
@@ -17,9 +17,7 @@
 static 
 struct tagstack_entry tagstack_pop(struct tagstack* tagstack);
 static 
-struct tagstack_entry tagstack_top(struct tagstack* tagstack);
-static 
-struct tagstack_entry* tagstack_head(struct tagstack* tagstack);
+struct tagstack_entry* tagstack_top(struct tagstack* tagstack);
 static 
 int tagstack_notempty(struct tagstack* tagstack);
 static 
@@ -30,6 +28,5 @@
 /*
  * Local Variables:
  * mode: c 
- * coding: cp1251
  * End: 
  */

Modified: branches/upstream/libhtml-template-pro-perl/current/tagstack.inc
URL: http://svn.debian.org/wsvn/branches/upstream/libhtml-template-pro-perl/current/tagstack.inc?rev=17629&op=diff
==============================================================================
--- branches/upstream/libhtml-template-pro-perl/current/tagstack.inc (original)
+++ branches/upstream/libhtml-template-pro-perl/current/tagstack.inc Sun Mar 16 05:30:35 2008
@@ -28,12 +28,7 @@
 }
 
 static 
-struct tagstack_entry tagstack_top(struct tagstack* tagstack) {
-  return *(tagstack->entry+tagstack->pos);
-}
-
-static 
-struct tagstack_entry* tagstack_head(struct tagstack* tagstack) {
+struct tagstack_entry* tagstack_top(struct tagstack* tagstack) {
   return tagstack->entry+tagstack->pos;
 }
 

Added: branches/upstream/libhtml-template-pro-perl/current/templates-Pro/test_if7.out
URL: http://svn.debian.org/wsvn/branches/upstream/libhtml-template-pro-perl/current/templates-Pro/test_if7.out?rev=17629&op=file
==============================================================================
--- branches/upstream/libhtml-template-pro-perl/current/templates-Pro/test_if7.out (added)
+++ branches/upstream/libhtml-template-pro-perl/current/templates-Pro/test_if7.out Sun Mar 16 05:30:35 2008
@@ -1,0 +1,14 @@
+<HTML><BODY>
+<H1> test_if7</H1>
+we test elsif here.
+test 1
+ VAR2 var2 defined (TRUE)
+end if test 1.
+
+test 2
+  var4 undefined (TRUE)
+end if test 2.
+
+
+<H1> END test_if7 </H1>
+</body></html>

Added: branches/upstream/libhtml-template-pro-perl/current/templates-Pro/test_if7.tmpl
URL: http://svn.debian.org/wsvn/branches/upstream/libhtml-template-pro-perl/current/templates-Pro/test_if7.tmpl?rev=17629&op=file
==============================================================================
--- branches/upstream/libhtml-template-pro-perl/current/templates-Pro/test_if7.tmpl (added)
+++ branches/upstream/libhtml-template-pro-perl/current/templates-Pro/test_if7.tmpl Sun Mar 16 05:30:35 2008
@@ -1,0 +1,18 @@
+<HTML><BODY>
+<H1> test_if7</H1>
+we test elsif here.
+test 1
+<tmpl_iF VAR4> <tmpl_var naMe="VAR4"> var4 defined (FALSE)
+<tMpl_elsiF VAR2> <tmpl_var naMe="VAR2"> var2 defined (TRUE)
+<tmpl_else> else (FALSE)
+</tmpl_if>end if test 1.
+
+test 2
+<tmpl_unless VAR4> <tmpl_var naMe="VAR4"> var4 undefined (TRUE)
+<tMpl_elsiF VAR2> <tmpl_var naMe="VAR2"> var2 defined (should be skipped)
+<tmpl_else> else (FALSE)
+</tmpl_if>end if test 2.
+
+
+<H1> END test_if7 </H1>
+</body></html>




More information about the Pkg-perl-cvs-commits mailing list