You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Charlie Hills <hi...@creditminders.com> on 2002/09/10 17:19:51 UTC
Question about preserving whitespace...
We're using embperl to generate dynamic email messages, but I'm having trouble
getting whitespace preserved between conditional statements. e.g.:
[$ if (this) $] * some text
[$ endif $]
[$ if (that) $] * some other text
[$ endif $]
produces:
* some text
* some other text
and not:
* some text
* some other text
as I might expect. If I separate the two if statements with more whitespace,
same result. The only time I can get it to preserve whitespace is to throw
something else in there. e.g., if I put a "." in there somewhere between the
statements, then it keeps the whitespace intact.
I even tried tossing in a [- print "\n" -] statement, to no avail!
Any thoughts? Should I just forget it and move on?
Charlie Hills
CreditMinders Development Team
512.263.7003 x223
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: Question about preserving whitespace...
Posted by Charlie Hills <hi...@creditminders.com>.
> > I also do not understand why your whitespace is being removed, but
> > perhaps the above will help (sorry - untested).
> >
>
> Only optKeepSpaces helps
>
> Gerald
And, as promised, it did help. Danke!
Charlie Hills
CreditMinders Development Team
512.263.7003 x223
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: Question about preserving whitespace...
Posted by Gerald Richter <ri...@ecos.de>.
> > I even tried tossing in a [- print "\n" -] statement, to no avail!
>
> did you try to print to the 'OUT' filehandle?
> [- print OUT "\n" -]
>
print to OUT does excatly the same as [+ +]
> I also do not understand why your whitespace is being removed, but
> perhaps the above will help (sorry - untested).
>
Only optKeepSpaces helps
Gerald
-------------------------------------------------------------
Gerald Richter ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting
Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz
E-Mail: richter@ecos.de Voice: +49 6133 925131
WWW: http://www.ecos.de Fax: +49 6133 925152
-------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: Question about preserving whitespace...
Posted by Cameron McBride <ca...@cwru.edu>.
> I even tried tossing in a [- print "\n" -] statement, to no avail!
did you try to print to the 'OUT' filehandle?
[- print OUT "\n" -]
I also do not understand why your whitespace is being removed, but
perhaps the above will help (sorry - untested).
Cameron
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: Question about preserving whitespace...
Posted by Gerald Richter <ri...@ecos.de>.
> We're using embperl to generate dynamic email messages, but I'm having
trouble
> getting whitespace preserved between conditional statements. e.g.:
>
Pass optKeepSpaces in options e.g.
Execute ({inputfile => xxx, options => HTML::Embperl::optKeepSpaces})
or set it in EMBPERL_OPTIONS.
Embperl tries to delete some unnecessary blank lines to keep the html output
more compact. optKeepSpaces disables this
Gerald
-------------------------------------------------------------
Gerald Richter ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting
Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz
E-Mail: richter@ecos.de Voice: +49 6133 925131
WWW: http://www.ecos.de Fax: +49 6133 925152
-------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: Question about preserving whitespace...
Posted by Charlie Hills <hi...@creditminders.com>.
> Regarding whitespace it's always a good idea to review the 'Inside
> Embperl' part of the documentation, summarized for 1.3.4 at:
>
> http://perl.apache.org/embperl/pod/doc/doc13/HTML/Embperl.-page-12-.htm
>
> but I don't know why it wouldn't leave that space inbetween tags alone
> either..
Aye, there's the rub! The whitespace rule is for stuff *within* tags. As my
whitespace is outside of the tags, I'm somewhat flummoxed that it would mangle
*my* code, and not the stuff within the tags. Seems like something else is going
on. I might dig a bit more.
Charlie Hills
CreditMinders Development Team
512.263.7003 x223
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: Question about preserving whitespace...
Posted by Nate Smith <na...@thebackrow.net>.
On Tue, Sep 10, 2002 at 10:39:46AM -0500, Charlie Hills wrote:
> Except it's not generating HTML, but the text for a plain text email. So the
Ah, I had missed the email part. If that's the case I guess we need
some more context to understand why it's not leaving that space in.
Are you using HTML::Embperl::Mail or just plain Embperl to generate the
mail?, etc.
Regarding whitespace it's always a good idea to review the 'Inside
Embperl' part of the documentation, summarized for 1.3.4 at:
http://perl.apache.org/embperl/pod/doc/doc13/HTML/Embperl.-page-12-.htm
but I don't know why it wouldn't leave that space inbetween tags alone
either..
Nate Smith
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: Question about preserving whitespace...
Posted by Charlie Hills <hi...@creditminders.com>.
> Realize that that is only making a hard break in the html document that
> then gets parsed by the browser.. HTML doesn't recognize whitespace in
> the document itself without a <pre> (preformatted) tag. So you could do
> one of two things:
>
> [$ if (blah) $] text1
> [$ endif $]
> <br>
> [$ if (blah2) $] text2
> [$ endif $]
Except it's not generating HTML, but the text for a plain text email. So the
<br> tag is definitely going to show up in the mail message body. That's why I
was hoping there'd be some invisible way of doing this. (First time I've ever
really tried to control the formatting of the output like this: normally, it's
all HTML and I don't care.) I figured that anything between tags would be left
alone by the embperl processing. That is, it'd process the first [$ if $]
statement, find the end of the statement, then spit out everything up to the
next statement as-is. Lather, rinse, repeat.
Charlie Hills
CreditMinders Development Team
512.263.7003 x223
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: Question about preserving whitespace...
Posted by Nate Smith <na...@thebackrow.net>.
On Tue, Sep 10, 2002 at 10:19:51AM -0500, Charlie Hills wrote:
> [$ if (this) $] * some text
> [$ endif $]
>
> [$ if (that) $] * some other text
> [$ endif $]
> I even tried tossing in a [- print "\n" -] statement, to no avail!
Realize that that is only making a hard break in the html document that
then gets parsed by the browser.. HTML doesn't recognize whitespace in
the document itself without a <pre> (preformatted) tag. So you could do
one of two things:
[$ if (blah) $] text1
[$ endif $]
<br>
[$ if (blah2) $] text2
[$ endif $]
or use <pre> .. </pre> tags, but that's just wrong :)
Nate Smith
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org