[MKDoc-commit] [Petal] alias false: modifier as not: to match TALES
spec
bruno at mkdoc.demon.co.uk
bruno at mkdoc.demon.co.uk
Fri Jan 27 13:11:24 GMT 2006
Log Message:
-----------
[Petal] alias false: modifier as not: to match TALES spec
Modified Files:
--------------
Petal:
Changes
MANIFEST
Petal/lib/Petal:
Hash.pm
Added Files:
-----------
Petal/t:
094_notfalse.t
Petal/t/data:
notfalse.xml
-------------- next part --------------
Index: MANIFEST
===================================================================
RCS file: /var/spool/cvs/Petal/MANIFEST,v
retrieving revision 1.53
retrieving revision 1.54
diff -LMANIFEST -LMANIFEST -u -r1.53 -r1.54
--- MANIFEST
+++ MANIFEST
@@ -98,6 +98,7 @@
t/091_attribute-newline.t
t/092_on-error.t
t/093_translate.t
+t/094_notfalse.t
t/benchmark.pl
t/data/access_obj_array.html
t/data/access_obj_hash.html
@@ -176,6 +177,7 @@
t/data/nbsp.html
t/data/nested_modifiers/test1.xml
t/data/nested_modifiers/test2.xml
+t/data/notfalse.xml
t/data/omit-tag.xml
t/data/pass_variables/attributes.html
t/data/pass_variables/content.html
Index: Changes
===================================================================
RCS file: /var/spool/cvs/Petal/Changes,v
retrieving revision 1.143
retrieving revision 1.144
diff -LChanges -LChanges -u -r1.143 -r1.144
--- Changes
+++ Changes
@@ -1,5 +1,8 @@
Revision history for Petal.
+2.19
+ - alias false: modifier as not: to match TALES spec (Jonathan)
+
2.18 Tue Jan 17 13:01:00 2006
- $Petal::CodeGenerator::PI_RE should be applied newline insensitively
- pod fixes
Index: Hash.pm
===================================================================
RCS file: /var/spool/cvs/Petal/lib/Petal/Hash.pm,v
retrieving revision 1.27
retrieving revision 1.28
diff -Llib/Petal/Hash.pm -Llib/Petal/Hash.pm -u -r1.27 -r1.28
--- lib/Petal/Hash.pm
+++ lib/Petal/Hash.pm
@@ -70,6 +70,7 @@
return not $hash->fetch ("true:$variable");
};
+$MODIFIERS->{'not:'} = $MODIFIERS->{'false:'};
# encode: modifier (deprecated stuff)
$MODIFIERS->{'encode:'} = sub {
--- /dev/null
+++ t/094_notfalse.t
@@ -0,0 +1,28 @@
+#!/usr/bin/perl
+use warnings;
+use strict;
+use lib ('lib');
+use Test::More 'no_plan';
+use Petal;
+
+$|=1;
+
+$Petal::BASE_DIR = './t/data/';
+$Petal::DISK_CACHE = 0;
+$Petal::MEMORY_CACHE = 0;
+$Petal::TAINT = 1;
+
+my $template_file = 'notfalse.xml';
+my $template = new Petal ($template_file);
+my $string = $template->process (always_false => 0, always_true => 1);
+
+like ($string, qr/A/, 'test A');
+unlike ($string, qr/B/, 'test B');
+like ($string, qr/C/, 'test C');
+unlike ($string, qr/D/, 'test D');
+unlike ($string, qr/E/, 'test E');
+like ($string, qr/F/, 'test F');
+unlike ($string, qr/G/, 'test G');
+like ($string, qr/H/, 'test H');
+
+__END__
--- /dev/null
+++ t/data/notfalse.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<foo xmlns:petal="http://purl.org/petal/1.0/">
+ <bar petal:condition="false: always_false">Test A</bar>
+ <bar petal:condition="true: always_false">Test B</bar>
+ <bar petal:condition="not: always_false">Test C</bar>
+ <bar petal:condition="always_false">Test D</bar>
+
+ <bar petal:condition="false: always_true">Test E</bar>
+ <bar petal:condition="true: always_true">Test F</bar>
+ <bar petal:condition="not: always_true">Test G</bar>
+ <bar petal:condition="always_true">Test H</bar>
+</foo>
More information about the MKDoc-commit
mailing list