dev-master
9999999-dev https://www.github.com/Savageman/zenmlConverts Hamlbar-like string to Handlebars template
MIT
The Requires
- php >=5.3.0
by Julian Espérat (Savageman)
templating handlebars haml
Converts Hamlbar-like string to Handlebars template
I love Handlebars, but I find it still lacks indentation-based DOM tree (like Haml) & Emmet/CSS syntax for ID and classes., (*1)
So I made this pre-processor to solve the problem. It generates Handlebars., (*2)
%
;{{#helpers}}
;title="This is the title"
;text
attribute of the current tag: text="This is my text"
%h1 text="This is my title" %div #container {{ #each items }} %h2 text="{{title}}" %span .date text="{{date}}" %div .description The description is a bit longer, so I split it on several lines. {{ else }} %p text="Nothing here..." %footer This is the end of the example.
is converted into:, (*3)
This is my title
{{#each items}}<footer> This is the end of the example. </footer>{{title}}
{{date}}The description is a bit longer, so I split it on several lines.{{else}}Nothing here..., (*4)
{{/each}}
$template = <<<TEMPLATE %div id="test" %p text="First line" %p text="Second line" Plain-text for the end TEMPLATE; $zenml = new Zenml\Zenml(array( 'prepend' => '', 'input_indentation' => ' ', 'output_indentation' => ' ', )); echo htmlspecialchars($zenml->render($template));
(I'll be glad if people could help me out sorting these out.), (*5)
#id
and .classes
attributes ;Converts Hamlbar-like string to Handlebars template
MIT
templating handlebars haml