Skip to content

fitoria/HamlPy

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HamlPy

HamlPy (pronounced "haml pie") is a tool for Django developers who want to use a Haml like syntax for their templates. HamlPy is not a template engine in itself but simply a compiler which will convert HamlPy files into templates that Django can understand.

But wait, what is Haml? Haml is an incredible template engine written in Ruby used a lot in the Rails community. You can read more about it here

Syntax

Almost all of the XHTML syntax of Haml is preserved.

#profile
	.left.column
		#date 2010/02/18
		#address Toronto, ON
	.right.column
		#bio Jesse Miller

turns into..

<div id='profile'>
	<div class='left column'>
		<div id='date'>2010/02/18</div>
		<div id='address'>Toronto, ON</div>
	</div>
	<div class='right column'>
		<div id='bio'>Jesse Miller</div>
	</div>
</div>

The main difference is instead of interpretting Ruby, or even Python we instead can create Django Tags and Variables

%ul#atheletes
	- for athelete in athelete_list
		%li.athelete= athelete.name

turns into..

<ul id='atheletes'>
	{% for athelete in athelete_list %}
		<li class='athelete'>{{ athelete.name }}</li>
	{% endfor %}
</ul>

Reference

Check out the reference.md for a complete reference and more examples.

Status

HamlPy currently cannot:

  • Do variable interpolation. So there is currently no way to go %p This is some cool #{coolThing.text}.

About

A converter of HAML like templates into Django templates.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.6%
  • Ruby 0.4%