r17631 - in /trunk/libhtml-template-pro-perl: ./ debian/ lib/HTML/Template/ t/ templates-Pro/

roberto at users.alioth.debian.org roberto at users.alioth.debian.org
Sun Mar 16 05:32:04 UTC 2008


Author: roberto
Date: Sun Mar 16 05:32:03 2008
New Revision: 17631

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=17631
Log:
* New upstream release.

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

Modified: trunk/libhtml-template-pro-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-template-pro-perl/Changes?rev=17631&op=diff
==============================================================================
--- trunk/libhtml-template-pro-perl/Changes (original)
+++ trunk/libhtml-template-pro-perl/Changes Sun Mar 16 05:32:03 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: trunk/libhtml-template-pro-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-template-pro-perl/MANIFEST?rev=17631&op=diff
==============================================================================
--- trunk/libhtml-template-pro-perl/MANIFEST (original)
+++ trunk/libhtml-template-pro-perl/MANIFEST Sun Mar 16 05:32:03 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: trunk/libhtml-template-pro-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-template-pro-perl/META.yml?rev=17631&op=diff
==============================================================================
--- trunk/libhtml-template-pro-perl/META.yml (original)
+++ trunk/libhtml-template-pro-perl/META.yml Sun Mar 16 05:32:03 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: trunk/libhtml-template-pro-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-template-pro-perl/Makefile.PL?rev=17631&op=diff
==============================================================================
--- trunk/libhtml-template-pro-perl/Makefile.PL (original)
+++ trunk/libhtml-template-pro-perl/Makefile.PL Sun Mar 16 05:32:03 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: trunk/libhtml-template-pro-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-template-pro-perl/README?rev=17631&op=diff
==============================================================================
--- trunk/libhtml-template-pro-perl/README (original)
+++ trunk/libhtml-template-pro-perl/README Sun Mar 16 05:32:03 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: trunk/libhtml-template-pro-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-template-pro-perl/debian/changelog?rev=17631&op=diff
==============================================================================
--- trunk/libhtml-template-pro-perl/debian/changelog (original)
+++ trunk/libhtml-template-pro-perl/debian/changelog Sun Mar 16 05:32:03 2008
@@ -1,3 +1,9 @@
+libhtml-template-pro-perl (0.69-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Roberto C. Sanchez <roberto at debian.org>  Sun, 16 Mar 2008 01:31:42 -0400
+
 libhtml-template-pro-perl (0.68.1-1) unstable; urgency=low
 
   [ Jose Luis Rivas ]

Modified: trunk/libhtml-template-pro-perl/lib/HTML/Template/Pro.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-template-pro-perl/lib/HTML/Template/Pro.pm?rev=17631&op=diff
==============================================================================
--- trunk/libhtml-template-pro-perl/lib/HTML/Template/Pro.pm (original)
+++ trunk/libhtml-template-pro-perl/lib/HTML/Template/Pro.pm Sun Mar 16 05:32:03 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: trunk/libhtml-template-pro-perl/lib/HTML/Template/SYNTAX.pod
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-template-pro-perl/lib/HTML/Template/SYNTAX.pod?rev=17631&op=diff
==============================================================================
--- trunk/libhtml-template-pro-perl/lib/HTML/Template/SYNTAX.pod (original)
+++ trunk/libhtml-template-pro-perl/lib/HTML/Template/SYNTAX.pod Sun Mar 16 05:32:03 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: trunk/libhtml-template-pro-perl/perl-HTML-Template-Pro.spec
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-template-pro-perl/perl-HTML-Template-Pro.spec?rev=17631&op=diff
==============================================================================
--- trunk/libhtml-template-pro-perl/perl-HTML-Template-Pro.spec (original)
+++ trunk/libhtml-template-pro-perl/perl-HTML-Template-Pro.spec Sun Mar 16 05:32:03 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: trunk/libhtml-template-pro-perl/procore.c
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-template-pro-perl/procore.c?rev=17631&op=diff
==============================================================================
--- trunk/libhtml-template-pro-perl/procore.c (original)
+++ trunk/libhtml-template-pro-perl/procore.c Sun Mar 16 05:32:03 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: trunk/libhtml-template-pro-perl/t/HTML-Template-Pro.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-template-pro-perl/t/HTML-Template-Pro.t?rev=17631&op=diff
==============================================================================
--- trunk/libhtml-template-pro-perl/t/HTML-Template-Pro.t (original)
+++ trunk/libhtml-template-pro-perl/t/HTML-Template-Pro.t Sun Mar 16 05:32:03 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: trunk/libhtml-template-pro-perl/tagstack.h
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-template-pro-perl/tagstack.h?rev=17631&op=diff
==============================================================================
--- trunk/libhtml-template-pro-perl/tagstack.h (original)
+++ trunk/libhtml-template-pro-perl/tagstack.h Sun Mar 16 05:32:03 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: trunk/libhtml-template-pro-perl/tagstack.inc
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-template-pro-perl/tagstack.inc?rev=17631&op=diff
==============================================================================
--- trunk/libhtml-template-pro-perl/tagstack.inc (original)
+++ trunk/libhtml-template-pro-perl/tagstack.inc Sun Mar 16 05:32:03 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;
 }
 




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