From u15119 at hs-harz.de Sat Jan 14 18:10:18 2006 From: u15119 at hs-harz.de (Christoph Thielecke) Date: Sat Jan 14 18:11:15 2006 Subject: [Petal] Petal bug: sub elements not translated Message-ID: <200601141910.23375.u15119@hs-harz.de> Hi list, I've upgraded from 2.14 to 2.17 and the translation of substrings stops to work. Here is an example: Fedora Core 4 RPMs added (RPM, Debug RPM). will produce: Fedora Core 4 RPMs added (${1}, ${2}). In 2.14 the ${1} will be replaced with the first sub string (...), in 2.17 this wont work. Can you fix that? Best regards Christoph -- Linux User Group Wernigerode http://www.lug-wr.de/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : https://lists.webarch.co.uk/pipermail/petal/attachments/20060114/6ab2cb0a/attachment.bin From bruno at mkdoc.com Tue Jan 17 13:26:16 2006 From: bruno at mkdoc.com (Bruno Postle) Date: Tue Jan 17 13:26:33 2006 Subject: [Petal] bug: sub elements not translated (and 2.18 released) In-Reply-To: <200601141910.23375.u15119@hs-harz.de> References: <200601141910.23375.u15119@hs-harz.de> Message-ID: <20060117132616.GA2756@mkdoc.com> On Sat 14-Jan-2006 at 19:10 +0100, Christoph Thielecke wrote: > > I've upgraded from 2.14 to 2.17 and the translation of substrings > stops to work. Yes thanks for the test, this was a bug introduced into 2.16 to allow template designers to use text such as ${1} and ${5foo} in templates. I've reverted to the old behaviour and released Petal-2.18 to CPAN, though it may not have yet appeared on your local mirror. Changes since 2.17: * $Petal::CodeGenerator::PI_RE should be applied newline insensitively, petal attributes can now contain multiple lines. * Minor pod fixes. * Cookbook tal:repeat example (DSL) * Pod note that on-error isn't fully implemented * Defang html metacharacters in on-error output * Undo 2.16 $Petal::Hash::String::VARIABLE_RE_BRACKETS ${1} regression -- Bruno From u15119 at hs-harz.de Tue Jan 17 13:31:02 2006 From: u15119 at hs-harz.de (Christoph Thielecke) Date: Tue Jan 17 13:31:58 2006 Subject: [Petal] bug: sub elements not translated (and 2.18 released) In-Reply-To: <20060117132616.GA2756@mkdoc.com> References: <200601141910.23375.u15119@hs-harz.de> <20060117132616.GA2756@mkdoc.com> Message-ID: <200601171431.02754.u15119@hs-harz.de> Hello Bruno, > > I've upgraded from 2.14 to 2.17 and the translation of substrings > > stops to work. > > Yes thanks for the test, this was a bug introduced into 2.16 to > allow template designers to use text such as ${1} and ${5foo} in > templates. > > I've reverted to the old behaviour and released Petal-2.18 to CPAN, > though it may not have yet appeared on your local mirror. Thx a lot. Best regards Christoph -- Linux User Group Wernigerode http://www.lug-wr.de/ -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : https://lists.webarch.co.uk/pipermail/petal/attachments/20060117/4f9cc506/attachment.bin From petal-list at 2xlp.com Fri Jan 20 21:20:04 2006 From: petal-list at 2xlp.com (Jonathan) Date: Fri Jan 20 21:48:41 2006 Subject: [Petal] bug: documentation uses unsupported (but TAL spec) modifier In-Reply-To: <200601171431.02754.u15119@hs-harz.de> References: <200601141910.23375.u15119@hs-harz.de> <20060117132616.GA2756@mkdoc.com> <200601171431.02754.u15119@hs-harz.de> Message-ID: <73E5F164-0603-46AC-A6D8-36D945776B6A@2xlp.com> I noticed this today in the petal documentation: ======= omit-tag Abstract Some contents Example I may not be bold. If not:bold is evaluated as TRUE, then the tag will be omited. If not:bold is evaluated as FALSE, then the tag will stay in place. Why? omit-tag statements can be used to leave the contents of a tag in place while omitting the surrounding start and end tags if the expression which is evaluated is TRUE. TIP: If you want to ALWAYS remove a tag, you can use omit-tag="string:1" ======= i've discussed this before, but "not:" is a TAL modifier that isn't in petal i just wanted to bring this up again, as following the docs in this case will cause an error i suggest either: * patching petal to use not: which is in the TAL spec (patch below) * including the Petal Modifier on the TAL doc, so that will work and others in the future will see it * changing the docs from not to false in that order of preference Petal Modifier method: ===== use Petal (); $Petal::Hash::MODIFIERS->{'not:'} = sub { return ( $_[0]->fetch($_ [1]) ? 0 : 1 ); }; ===== Patch ===== diff -Naur Petal-2.18-dist/lib/Petal/Hash.pm Petal-2.18-patched/lib/ Petal/Hash.pm --- Petal-2.18-dist/lib/Petal/Hash.pm 2005-03-16 10:23:36.000000000 -0500 +++ Petal-2.18-patched/lib/Petal/Hash.pm 2006-01-20 16:08:20.000000000 -0500 @@ -71,6 +71,14 @@ }; +# not modifier +$MODIFIERS->{'not:'} = sub { + my $hash = shift; + my $variable = join ' ', @_; + return not $hash->fetch ("true:$variable"); +}; + + # encode: modifier (deprecated stuff) $MODIFIERS->{'encode:'} = sub { warn "Petal modifier encode: is deprecated"; ===== Sorry, but I don't know the correct way to generate a diff for patching. it's just adding this ==== # not modifier $MODIFIERS->{'not:'} = sub { my $hash = shift; my $variable = join ' ', @_; return not $hash->fetch ("true:$variable"); }; ===== to lib/Petal/Hash.pm - its an exact copy of the false function, just s/false/not/g , and right below it. there's probably a better way to consolidate not: and false: into 1 modifier, but that works. From jon at 2xlp.com Wed Jan 25 06:45:14 2006 From: jon at 2xlp.com (Jonathan Vanasco) Date: Wed Jan 25 08:42:25 2006 Subject: [Petal] bug: documentation uses unsupported (but TAL spec) modifier In-Reply-To: <73E5F164-0603-46AC-A6D8-36D945776B6A@2xlp.com> References: <200601141910.23375.u15119@hs-harz.de> <20060117132616.GA2756@mkdoc.com> <200601171431.02754.u15119@hs-harz.de> <73E5F164-0603-46AC-A6D8-36D945776B6A@2xlp.com> Message-ID: actually, i realized a more elegant solution- lib/Petal/Hash.pm ( add this line @72 ) ===== $MODIFIERS->{'not:'} = $MODIFIERS->{'false:'}; ===== that uses the same approach as the rest of Petal. I was tired and didn't notice that would work earlier. sorry for suggesting a poor patch earlier. From bruno at mkdoc.com Fri Jan 27 13:31:05 2006 From: bruno at mkdoc.com (Bruno Postle) Date: Fri Jan 27 13:31:10 2006 Subject: [Petal] bug: documentation uses unsupported (but TAL spec) modifier In-Reply-To: <73E5F164-0603-46AC-A6D8-36D945776B6A@2xlp.com> References: <200601141910.23375.u15119@hs-harz.de> <20060117132616.GA2756@mkdoc.com> <200601171431.02754.u15119@hs-harz.de> <73E5F164-0603-46AC-A6D8-36D945776B6A@2xlp.com> Message-ID: <20060127133105.GE1993@mkdoc.com> On Fri 20-Jan-2006 at 16:20 -0500, Jonathan wrote: > > i've discussed this before, but "not:" is a TAL modifier that isn't > in petal > i suggest either: > * patching petal to use not: which is in the TAL spec (patch below) > * changing the docs from not to false Thanks, I've added 'not:' as an alias to 'false:' in Petal::Hash. Note that 'not:', 'string:' and 'path:' are required by TALES: http://www.zope.org/Wikis/DevSite/Projects/ZPT/TALES%20Specification%201.3 So Petal is still missing 'path:'. -- Bruno From petal-list at 2xlp.com Fri Jan 27 16:28:36 2006 From: petal-list at 2xlp.com (Jonathan Vanasco) Date: Fri Jan 27 16:28:59 2006 Subject: [Petal] bug: documentation uses unsupported (but TAL spec) modifier In-Reply-To: <20060127133105.GE1993@mkdoc.com> References: <200601141910.23375.u15119@hs-harz.de> <20060117132616.GA2756@mkdoc.com> <200601171431.02754.u15119@hs-harz.de> <73E5F164-0603-46AC-A6D8-36D945776B6A@2xlp.com> <20060127133105.GE1993@mkdoc.com> Message-ID: <461CC40C-CDBF-448F-AD7A-3566AEDCE693@2xlp.com> On Jan 27, 2006, at 8:31 AM, Bruno Postle wrote: > Thanks, I've added 'not:' as an alias to 'false:' in Petal::Hash. > > Note that 'not:', 'string:' and 'path:' are required by TALES: > http://www.zope.org/Wikis/DevSite/Projects/ZPT/TALES% > 20Specification%201.3 > > So Petal is still missing 'path:'. I guess the first person who needs to use it gets to make the patch! ( crosses fingers and hopes thats not me ) From bruno at mkdoc.com Mon Jan 30 16:21:59 2006 From: bruno at mkdoc.com (Bruno Postle) Date: Mon Jan 30 16:27:09 2006 Subject: [Petal] bug: documentation uses unsupported (but TAL spec) modifier In-Reply-To: References: <200601141910.23375.u15119@hs-harz.de> <20060117132616.GA2756@mkdoc.com> <200601171431.02754.u15119@hs-harz.de> <73E5F164-0603-46AC-A6D8-36D945776B6A@2xlp.com> Message-ID: <43DE3D27.2000102@mkdoc.com> Jonathan Vanasco wrote: > > actually, i realized a more elegant solution- > $MODIFIERS->{'not:'} = $MODIFIERS->{'false:'}; Yep, that's exactly what I did: https://lists.webarch.co.uk/pipermail/mkdoc-commit/2006-January/001087.html -- Bruno