From garry.espe at chsinc.com Thu May 5 18:54:14 2005 From: garry.espe at chsinc.com (garry espe) Date: Thu May 5 19:07:03 2005 Subject: [Petal] Style Sheet difficulties Message-ID: I have been experimenting with petal templates and perl. I am having no luck incorporating style sheets. I copied a style sheet that I use with a python-tal application. It should be as simple as referencing the file with a STYLE tag, then using the classes in the html pages. I cannot get it to work! I admit I am a rank rookie with respect to style sheets. I suspect that rookieness really is the source of the problem. Still I would appreciate any help that can be offered. Here is the snippet of code that references the style sheet file: Dummy Content Here are the first few lines of css code from style.css: td.page-header-left { padding: 5px; border-bottom: 1px solid #444444; } And here are the error messages in the apache log: [Thu May 5 11:22:02 2005] [error] [client 172.31.36.67] Bareword found where operator expected at /var/www/perl/style.css line 2, near "5px" (Missing operator before px?) Thu May 5 11:22:22 2005] [error] syntax error at /var/www/perl/style.css line 2, near "5px" syntax error at /var/www/perl/style.css line 3, near "bottom:" syntax error at /var/www/perl/style.css line 7, near "5px" From william at knowmad.com Thu May 5 21:46:37 2005 From: william at knowmad.com (William McKee) Date: Thu May 5 21:46:21 2005 Subject: [Petal] Metal includes Message-ID: <20050505204637.GK776@knowmad.com> Hi all, I think that I've come across something which should be handled better by Petal or at least documented. If an include file is not valid XML, it will be silently ignored. I was struggling the other day trying to figure out why my includes stopped working while upgrading some old templates to the latest version of Petal (ok, some really old templates). Once, I fixed the XML problems, the includes started working. There was no error or warning message in the logs. At one point, I seem to recall seeing an inline error message in the html source page at one point but have not confirmed that this is how Petal handles import error. If someone can confirm that, I will update the docs. Also, does anyone know if there is a way to have an included macro only insert the contents rather than the surrounding tags? I'm ending up with div tags in my header due to the need to create valid XML include files. The resulting file is not valid XHTML. Finally, there are a couple typos in the macros section of the POD. It looks like the use-macro and define-macro definitions got mixed up so that they wrong macro is being referenced. I can make that fix when I update the above. Thanks, William -- Knowmad Services Inc. http://www.knowmad.com From grant at mclean.net.nz Thu May 5 21:59:26 2005 From: grant at mclean.net.nz (Grant McLean) Date: Thu May 5 21:59:05 2005 Subject: [Petal] Style Sheet difficulties In-Reply-To: References: Message-ID: <1115326766.11257.6.camel@localhost> On Thu, 2005-05-05 at 17:54 +0000, garry espe wrote: > I have been experimenting with petal templates and perl. I am having no luck > incorporating style sheets. ... > And here are the error messages in the apache log: > > [Thu May 5 11:22:02 2005] [error] [client 172.31.36.67] Bareword found where > operator expected at /var/www/perl/style.css line 2, near "5px" > (Missing operator before px?) It appears that your stylesheet is being interpreted as a Perl script. This is definitely not a Petal problem, but possibly an Apache config issue. Are you calling Petal from a CGI script? If so, the stylesheet probably shouldn't be in the CGI directory. Perhaps you could move it to the docroot directory and change you template to include a leading / @import url(/style.css); By the way, is there any reason why you're using import rather than a tag?: If you're not using CGI, are you using mod_perl? Perhaps you have a Perl handler configured on a whole directory rather than just certain file extensions? Regards Grant From garry.espe at chsinc.com Fri May 6 15:51:15 2005 From: garry.espe at chsinc.com (garry espe) Date: Fri May 6 16:00:31 2005 Subject: [Petal] Re: Style Sheet difficulties References: <1115326766.11257.6.camel@localhost> Message-ID: Grant McLean writes: > > It appears that your stylesheet is being interpreted as a Perl script. > This is definitely not a Petal problem, but possibly an Apache config > issue. Yes, I believe this was the problem. > > Are you calling Petal from a CGI script? If so, the stylesheet probably > shouldn't be in the CGI directory. Perhaps you could move it to the > docroot directory and change you template to include a leading / > > import url(/style.css); > I am using mod_perl. I moved the style sheet and other html files to the doc root directory, and the problems vanished -- all except one. > By the way, is there any reason why you're using import rather than a > tag?: > > I tried this, which produced a PETAL tokenizer error. PETAL does not bark when I use the import construct. Even with the construct, PETAL coughs when I tryin to reference a style sheet class, like this: Goodbye Here is the error message: [Fri May 6 09:38:00 2005] [error] [PETAL ERROR] cannot tokenize: Goodbye at /usr/lib/perl5/site_perl/5.6.1/MKDoc/XML/Tokenizer.pm line 89. . Debug info written in /tmp/petal_debug.8605.1115390280.ucwdsnhgwi. at /usr/lib/perl5/site_perl/5.6.1/Petal.pm line 473. Any ideas? Garry p.s. Thanks for helping me get untracked. I was not thinking clearly at all about the apache config. From garry.espe at chsinc.com Fri May 6 16:34:03 2005 From: garry.espe at chsinc.com (garry espe) Date: Fri May 6 16:42:39 2005 Subject: [Petal] Re: Style Sheet difficulties References: <1115326766.11257.6.camel@localhost> Message-ID: garry espe writes: > Goodbye > Here is the error message: > [PETAL ERROR] cannot tokenize: CLASS=sidebar> Goodbye at Now I am answering my own post. I forgot to encase the stylesheet class value in double quotes. Things are working fine -- including the I'm not going to stop using Petal, but I have to admit the error messages leave a bit to be desired. I can't even make too much out of the /tmp/petal_debug files. Did someone previously mention dumping the value of a variable at a point, perhaps into html comments or something? And, if I wrote a parser that was, say, twice as fast for Petal... um, could I get a job? I might change it up a little, make it like petal:repeat="$a @array" where petal:repeat="$b %hash" would always imply $b would be looping through the keys of the hash. :-D -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://lists.webarch.co.uk/pipermail/petal/attachments/20050506/8d6adcbb/attachment.bin From fergald at gmail.com Sat May 7 00:56:20 2005 From: fergald at gmail.com (Fergal Daly) Date: Sat May 7 00:55:56 2005 Subject: [Petal] Petal error messages In-Reply-To: <20050506232415.GA7628@narins.net> References: <20050506232415.GA7628@narins.net> Message-ID: <87502996050506165646fa633a@mail.gmail.com> If you want to speed up Petal, you'll not have much luck with the TAL stuff, that's close to optimal I think. The TALES stuff is what's slow as it's interpretted at run time. See http://search.cpan.org/~fdaly/Petal-CodePerl-0.06/ for something that compiles all the expressions. I doubt it works against the current version of Petal though, F On 5/7/05, Josh Narins wrote: > I'm not going to stop using Petal, but I have to admit the error > messages leave a bit to be desired. > > I can't even make too much out of the /tmp/petal_debug files. > > Did someone previously mention dumping the value of a variable at a > point, perhaps into html comments or something? > > And, if I wrote a parser that was, say, twice as fast for Petal... um, > could I get a job? > > I might change it up a little, make it like petal:repeat="$a @array" > where petal:repeat="$b %hash" would always imply $b would be looping > through the keys of the hash. > > :-D > > > From josh at narins.net Sat May 7 21:07:12 2005 From: josh at narins.net (Josh Narins) Date: Sat May 7 21:06:50 2005 Subject: [Petal] Bug? True and false at the same time. Message-ID: <20050507200712.GA13006@narins.net> I have two sections like and and they are both showing up. I am not doing anything to change the values as it goes along. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Digital signature Url : http://lists.webarch.co.uk/pipermail/petal/attachments/20050507/0a2b876d/attachment.bin From kstep at pepsdesign.com Mon May 9 02:29:39 2005 From: kstep at pepsdesign.com (Kurt Stephens) Date: Mon May 9 02:29:18 2005 Subject: [Petal] Documentation RE xmlns:metal Message-ID: <001101c55436$93a4deb0$0301a8c0@ishmael> Hi All, I finally got around to working with METAL, and came across a minor annoyance that I thought was a bug, but turns out to be more a matter of missing documentation. This includes the section on the petal and metal namespaces in the current (2.16) Petal cookbook. First of all, I am using METAL to build the boilerplate HTML around a Petal template that uses metal:fill-slot to provide the content. The included METAL master page itself uses Petal commands for such things as the page title. In order to get Petal and METAL to work together, you must define the namespace for both. I expected this and without reading the docs I tried the following, which turns out to be almost exactly what the cookbook says to do under "Fixing invalid templates". Actually, the cookbook places semicolons after the xmlns attributes, leading me to believe that William must be spending too much time hacking Perl ;) As a result, Petal ignores any petal: commands called within the master template. My first thought was to change the metal: namespace. Again, without consulting the docs I changed it to the following: xmlns:metal="http://purl.org/petal/1.0/" <= WRONG! Everything now works, except for the fact that the xmlns:metal attribute is not stripped from the final output. As I said in the beginning, a minor annoyance. I started looking at Petal.pm to try to figure out why this was happening and noticed the following lines: our $MT_NS = 'metal'; our $MT_NS_URI = 'http://xml.zope.org/namespaces/metal'; Problem solved. To correctly define the petal and metal namespaces, use the following: We should correct the section in the Petal cookbook and add this to the main documentation in Petal.pm. I will post a patch against the current 2.16 code so that we can add this whenever the next version comes out. Cheers, Kurt Stephens From josh at narins.net Wed May 18 01:35:17 2005 From: josh at narins.net (Josh Narins) Date: Wed May 18 01:35:06 2005 Subject: [Petal] Variables within variables. Message-ID: <20050518003517.GA27623@narins.net> Hi all. What I want, in perl, would look like this. $tal->{onething}->{ $tal->{otherthing} } I tried string:stuff${onething/${otherthing}} but it didn't work. Is this supported, or should I work around? Thanks in advance. I still have a suspiction that a SAX parser with heavy use of memoization would be faster, but it's no trouble for me now. I'm even getting close to being able to show off a primitive version of the site I'm building. I'll mention it here when appropriate. From josh at narins.net Fri May 20 21:29:55 2005 From: josh at narins.net (Josh Narins) Date: Fri May 20 21:29:34 2005 Subject: [Petal] My petal site Message-ID: <20050520202955.GA12102@narins.net> It really has been great to work with Petal. I recently was able to xi:include the same xml file within two different loops, and, as I hoped, the variables are passed through correctly. Want to see? I require registration, I'm afraid, but its free. And only four required fields (username, e-mail, password, repeat, and agree to "terms"). http://narins.net:4321 (my ISP blocks 80) Well, *I* like it. The Petal owners (MkDoc?) are free to use it internally for their own perpetual debates.