phphaml icon indicating copy to clipboard operation
phphaml copied to clipboard

Ruby string interpolation, double equals (==)

Open derDoc opened this issue 12 years ago • 2 comments

In Haml a double equals interpolates a string the same way that a single equals interpolates ruby code, although the doc itself is quite quiet about that. So this

- @student = 'derDoc'
%p= "Hello #{@student}"
produces the same result as
%p== Hello #{@student}

produces:

<p>Hello derDoc</p>
produces the same result as
<p>Hello derDoc</p>

The same (with php vars) run through phphaml however, produces this:

<?php $student = 'derDoc';?><p<?php $this->writeAttributes(array (), array($student)); ?>><?php echo "Hello #"; ?>
</p>
produces the same result as
<p<?php $this->writeAttributes(array (), array($student)); ?>><?php echo Hello #; ?>
</p>

derDoc avatar Feb 08 '13 21:02 derDoc

In case it wasn't clear, I don't use PHPHaml any more and am quite willing to cede maintainership of it, for example to Baldrs (https://github.com/Baldrs/phphaml).

glasserc avatar Feb 08 '13 23:02 glasserc

Oh... ok! You should put a notice in the readme and a link, maybe. Included it in my tests, though it doesnt compile more than yours, some more are logically correct now ;)

derDoc avatar Feb 09 '13 12:02 derDoc