Git Product home page Git Product logo

phphaml's Issues

Indentation handling

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 insertion following = (equals)

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>

HTML-style attributes

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

Filters

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.

Variable interpolation

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>

Implement Haml predefined filters

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.

Ruby string interpolation, double equals (==)

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>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.