garry espe | 5 May 19:54

Style Sheet difficulties

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:

<html>
	<head>
	<meta http-equiv="Content-Style-Type" content="text/css"></meta>
	<style type="text/css">
	<!--
	@import url(style.css);
	-->
	</style>
	</head>
    <body petal:content="bar">Dummy Content</body>

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
(Continue reading)

William McKee | 5 May 22:46
Favicon

Metal includes

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.
(Continue reading)

Grant McLean | 5 May 22:59
Picon
Favicon
Gravatar

Re: Style Sheet difficulties

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
<link> tag?:

  <link rel="stylesheet" type="text/css" href="/style.css" />

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?

(Continue reading)

garry espe | 6 May 16:51

Re: Style Sheet difficulties

Grant McLean <grant@...> 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 /
> 
>    <at> 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
> <link> tag?:
> 
>   <link rel="stylesheet" type="text/css" href="/style.css" />

I tried this, which produced a PETAL tokenizer error.  PETAL does not bark when
I use the <at> import construct.  Even with the <at> construct, PETAL coughs
when I tryin to reference a style sheet class, like this:
<td CLASS=sidebar> Goodbye </td>  
Here is the error message:
[Fri May  6 09:38:00 2005] [error] [PETAL ERROR] cannot tokenize: <td
CLASS=sidebar> Goodbye  at /usr/lib/perl5/site_perl/5.6.1/MKDoc/XML/Tokenizer.pm
(Continue reading)

garry espe | 6 May 17:34

Re: Style Sheet difficulties

garry espe <garry.espe@...> writes:

> <td CLASS=sidebar> Goodbye </td>  
> Here is the error message:
> [PETAL ERROR] cannot tokenize: <td > 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 <link rel... construct.
Thanks, Grant, for your assistance.

Garry

Josh Narins | 7 May 01:24

Petal error messages

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

Fergal Daly | 7 May 01:56
Picon

Re: Petal error messages

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 <josh@...> 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
> 
> 
>

(Continue reading)

Josh Narins | 7 May 22:07

Bug? True and false at the same time.

I have two sections like
<tr petal:condition="/hash/hash/array">
and
<tr petal:condition="false:/hash/hash/array">
and they are both showing up.

I am not doing anything to change the values as it goes along.
Kurt Stephens | 9 May 03:29

Documentation RE xmlns:metal

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 ;)

<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:petal="http://purl.org/petal/1.0/"
    xmlns:metal="http://purl.org/petal/1.0/"
    metal:define-macro="master">

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:
(Continue reading)

Josh Narins | 18 May 02:35

Variables within variables.

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.


Gmane