Download the PHP package zaitsev/mthamlphp without Composer
On this page you can find all versions of the php package zaitsev/mthamlphp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download zaitsev/mthamlphp
More information about zaitsev/mthamlphp
Files in zaitsev/mthamlphp
Package mthamlphp
Short Description HAML for PHP
License MIT
Homepage https://github.com/Zaitsev/MtHamlPHP
Informations about the package mthamlphp
Multi target HAML - IDE compiler (runtime reduced)
MtHaml is a PHP implementation of the HAML language which can target multiple languages. This is fork based on MtHaml and MtHaml-more (both runtimes supported if needed) Main target of this fork - implement compiling haml files to php in IDE (to not use any runtime).
differences
This implementation based on and supports all features of MtHaml and adds many new own. But its focused mostly to compile haml files to plain PHP, not to be used as template engine.
You can use grunt task and IDEA plugin to compile haml to php when editing haml-file in IDE.
for basic usage read MtHaml and MtHaml-more documentation.
support IDE highlight
to allow IDE recognize php code in :php section you can use it as
simplified array definitions
`['c','d']` is equeal to `array('c','d')`
all statements are equial:
attributes mixing
rendered
id attributes with prefixes with '_'
rendered
advanced data attribute
rendered
runtime if statement
rendered
see 05_selected_attribute.test in test/fixtures/environment directory
allowed to mix classes
rendered
includes
You can include or require haml partials
this is same as
use @@inlude /path/file
to inlude or @@require /path/file
to require files.
if file not found, require
will throw error and stop processing, include
will not.
new tag :haml
This section used to manage Run-time settings of compiler. You can change mostly any behavior or haml-parser and render options.
for :haml
section YAML syntax used.
Symfony YAML Component used to parse configs.
imports
You an use imports:
directive to include config files;
file config-1.yaml :
file config-2.yaml:
for more info about shortcut:
directive see below.
render
use includes_dir
option to set relative path to include configs.
compiler settings
You can set or change MtHaml Environment options:
rendered
Shortcuts
this inspired by Slim Shortcuts
define shortcut to render tag with attribute:
rendered
You can use shortcuts to render attributes of any tags:
rednder
You can not use PHP code in shortcuts
Custom helper functions
you can use own functions to render attributes
And yes, you can define them in :haml
section
common syntax is
The order of lookup - tag.attribute
, tag.*
, *.attribute
, *.*
custom helper (renderer) implemented similar to:
for example:
rendered to
and executed to
custom helpers used only for interpolated (parsed) attributes
%tag.a.b
will not use helpers to render class attribute
%tag.a{:class=>[$c,$d]}
will use custom helper
runtme engine selection
use_runtime
- if true, compiler will use standart runtime
see MtHaml documentation for more info of runtime usage;
render
_see 06_Customhelper.test in test/fixtures/environment directory for more custom helpers examples
added input type
you can use any type as :type_value for type="type_value"
after input tag:
rendered
no runtime for data attributes
see 06_Custom_helper.test in test/fixtures/environment directory