glasserc / phphaml Goto Github PK
View Code? Open in Web Editor NEWfork of phphaml to integrate bug fixes -- unmaintained
Home Page: http://phphaml.sourceforge.net/
fork of phphaml to integrate bug fixes -- unmaintained
Home Page: http://phphaml.sourceforge.net/
This is one of those iffy ones:
Should we allow ruby comments (-#) as well as Php style (-//) comments?
Some if the parsers that I tested do, because they are common enough in HAML files..
BTW, test is here: https://derdocsblog.wordpress.com/2013/02/07/haml-to-php-compiler/
Haml allows tabs as well as any amount of spaces as long as they are kept consistent.
phphaml only recognizes multiples of 2.
In addition whitespace inside of filters (think :preserve) MUST be preserved and passed to the filter as is.
Even if it is inconsistent. In other words, countLevel() should not throw an error inside of :filter code.
Code insertation following a '=' does not need a space.
-for ($i = 0; $i < 5; $i++)
=$i
should work. in PhpHaml however the resulting template is this:
-for ($i = 0; $i < 5; $i++)
<div><?php echo ; ?>
</div>
In Haml HTML-style aatributes work just like attribute hashes.
So this:
%html(xmlns="http://www.w3.org/1999/xhtml")
should result in this
<html xmlns="http://www.w3.org/1999/xhtml"></html>
Instead phphaml outputs this:
<html<?php $this->writeAttributes(array ('class' => 'w3 org')); ?>>
<?php echo ; ?>
Filter handling is broken, due to the subclassing of HamlLine to HamlParser.
HamlLine does not implement the method getAsSource().
Changing line 1284 to read
$oHaml = new HamlParser($this->sPath, $this->bCompile, $parent, array('line'=>$iLine, 'file'=>$this->sFile));
however fixes this.
Furthermore, since SassParser implements sass() as a static method the callable must be passed to registerBlock in line 217 as follows:
self::registerBlock(__NAMESPACE__ .'\SassParser::sass', 'sass');
The array(instance, method) only works for non-static methods.
I will submit patches for this (or a pull request) soon.
The title says it all, php code interpolation in plain test does not work.
%p You've pressed #{$_POST['run']} times on the submit button.
should result in
<p>You've pressed <?php echo $_POST['run'];?> times on the submit button.</p>
Haml comes predefined with quite a few filters (javascript, css etc).
These should be implemented by default in phphaml.
I already wrote a class for this, will submit it to my fork soon.
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>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.