diff --git a/readme.md b/readme.md index f3b3664..32c9ee9 100644 --- a/readme.md +++ b/readme.md @@ -21,40 +21,41 @@ The latest development version can be installed directly from GitHub: ## 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 - +```haml +#profile + .left.column + #date 2010/02/18 + #address Toronto, ON + .right.column + #bio Jesse Miller +``` turns into.. - -
-
-
2010/02/18
-
Toronto, ON
-
-
-
Jesse Miller
-
+```html +
+
+
2010/02/18
+
Toronto, ON
- +
+
Jesse Miller
+
+
+``` The main difference is instead of interpreting Ruby, or even Python we instead can create Django Tags and Variables - - %ul#athletes - - for athlete in athlete_list - %li.athlete{'id': 'athlete_{{ athlete.pk }}'}= athlete.name - +```haml +%ul#athletes + - for athlete in athlete_list + %li.athlete{'id': 'athlete_{{ athlete.pk }}'}= athlete.name +``` turns into.. - - +```html + +``` ## Usage @@ -63,13 +64,13 @@ turns into.. The template loader was originally written by [Chris Hartjes](https://github.com/chartjes) under the name 'djaml'. This project has now been merged into the HamlPy codebase. Add the HamlPy template loaders to the Django template loaders: - +```python TEMPLATE_LOADERS = ( 'hamlpy.template.loaders.HamlPyFilesystemLoader', 'hamlpy.template.loaders.HamlPyAppDirectoriesLoader', ... ) - +``` If you don't put the HamlPy template loader first, then the standard Django template loaders will try to process it first. Make sure your templates have a `.haml` or `.hamlpy` extension, and put them wherever you've told Django to expect to find templates (TEMPLATE_DIRS). @@ -77,15 +78,15 @@ to expect to find templates (TEMPLATE_DIRS). #### Template caching For caching, just add `django.template.loaders.cached.Loader` to your TEMPLATE_LOADERS: - - TEMPLATE_LOADERS = ( - ('django.template.loaders.cached.Loader', ( - 'hamlpy.template.loaders.HamlPyFilesystemLoader', - 'hamlpy.template.loaders.HamlPyAppDirectoriesLoader', - ... - )), - ) - +```python +TEMPLATE_LOADERS = ( + ('django.template.loaders.cached.Loader', ( + 'hamlpy.template.loaders.HamlPyFilesystemLoader', + 'hamlpy.template.loaders.HamlPyAppDirectoriesLoader', + ... + )), +) +``` #### Settings Following values in Django settings affect haml processing: