#90 [Opn->WFx]: Whitespace Trailing Substitution Eaten
| From: | alan_k@php.net | Date: | Mon, 13 Oct 2003 08:44:48 +0000 |
| Subject: | #90 [Opn->WFx]: Whitespace Trailing Substitution Eaten | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-22634@lists.php.net to get a copy of this message | ||
ID: 90
Updated by: alan_k@php.net
Reported By: mitch at enetis dot net
-Status: Open
+Status: Wont fix
Bug Type: HTML_Template_Flexy
Operating System: debian linux
PHP Version: 4.3.3
New Comment:
Work around: add a space after the } of a flexy tag..
The PHP issue is
echo -e "<?php echo 'hello'; ?>\nWorld" | php
prints helloWorld - removing the \n..
since flexy converts {xxx}\n into <?php echo $t->xxx; ?>\n
PHP is probably the guilty party here:)
I didnt really want second guess PHP.. here.. :) - I guess this gets a
wontfix :)
Previous Comments:
------------------------------------------------------------------------
[2003-10-12 22:18:08] alan_k@php.net
It's a known oddity of the php engine - it strips CR/LF following the
?>
Normally for emails, I'm tempted to recommend the regex parser -
$x = new HTML_Template_Flexy(array(
'compiler'=>'Regex',
'filters' => array('SimpleTags', 'mail'),
));
As it wont try and parse 'alan <alan@example.com>' as html.. = and also
has the fix for CR/LF adding..
------------------------------------------------------------------------
[2003-10-12 22:04:14] mitch at enetis dot net
Description:
------------
Newlines following a {variable} disappear after substitution.
This is not a big deal when generating HTML, obviously, but one sees
it
if one is using a template to make plain text, such as for an email.
Use the following two lines for template.text in the reproduce code:
W{foo}
{bar}Z
Later,
- Mitch
Reproduce code:
---------------
<?
require_once 'HTML/Template/Flexy.php';
$obj = new StdClass;
$obj->foo = 'X';
$obj->bar = 'Y';
$options = array('templateDir' => '.',
'compileDir' => '.',
'compiler' => 'Standard');
$output = new HTML_Template_Flexy($options);
$output->compile('template.text');
$output->outputObject($obj);
?>
Expected result:
----------------
WX
YZ
Actual result:
--------------
WXYZ
------------------------------------------------------------------------
--
Edit this bug report at http://pear.php.net/bugs/bug.php?id=90&edit=1