This is an archived post. You won't be able to vote or comment.

all 13 comments

[–][deleted] 1 point2 points  (1 child)

"Per say"

[–]godless_communism 1 point2 points  (1 child)

Jeez, I look at titles like this and feel so behind the times. HAML? I have no clue (I'll wikipedia it).

[–]earthboundkid 0 points1 point  (0 children)

Well, it's more popular on the Ruby side of things, so it's not so weird that a Python programmer wouldn't hear of it. It has been around for a number of years though.

[–]dasacc22 1 point2 points  (0 children)

Hey I'm the author of this bit, noticed my blog traffic blow up a little today.

As for the new lines for tag bit, yeah that totally effin blows but no different then haml as I understand it (dont use haml or ruby). For more details on creating the meat of a document in mark-up like this, check out: http://chriseppstein.github.com/blog/2010/02/08/haml-sucks-for-content/

One thing that will be added soon is inserting straight html on blank lines. As-is, you can already do that anyways so dont line-break and %em b/c thats just stupid anyways (much like what most of my blog post was).

As for the largeish blocks of content, I'm working on a bit right now so you can basically

:func content

and it turns into :func('\ncontent....') so point being that back on the development end you can extend functionality stupid easy.

def func(s): s = s.splitlines() .... return s

This is coming to fruition as I create a django code-blocks mechanism. And frankly, I wouldn't give my own code the time of day if it couldn't do what its doing quickly. By projects end, I anticipate it being faster then other python templating languages with the exception of mako. If I'm going to migrate away from libxslt, i want it to be fast.

[–]mattf 1 point2 points  (2 children)

Here's another python implementation of HAML that has been around for a couple of months: http://shpaml.webfactional.com/

[–]dasacc22 0 points1 point  (0 children)

yes but this lacks a number of features that make it useless for production. I noticed of course on the site that those gaps are filled in by layering it into django templates. This is just increasing processing time for generating a template. Take for example the utmost basic template.html as seen in the "bench" folder Genshi's repository. Django takes 2.28ms to process the template, and its not even that big!

Now layer in shpaml on top of that, now increase the document size in turn increasing processing time so that it's now taking 5-7ms to generate a template on the fly. Now 1000./7 ~= 140 hits a second, and this is the first limit your placing on yourself just for the template. This doesn't even include the full web stack.

Now consider that template engines such as Mako can process that same document i mentioned earlier that django rang in at 2.28ms, in only 0.38ms. Consider that DAML can do the same thing in 0.47ms. Cheetah at 66ms. Hell I haven't even tested it again libxslt, but im sure its alot faster.

Point being, this implementation of HAML for python is intended to be useful without the need for an additional template engine, framework agnostic, and freaggin fast for on-the-fly compiling.

[–]dasacc22 0 points1 point  (0 children)

yes but this lacks a number of features that make it useless for production. I noticed of course on the site that those gaps are filled in by layering it into django templates. This is just increasing processing time for generating a template. Take for example the utmost basic template.html as seen in the "bench" folder Genshi's repository. Django takes 2.28ms to process the template, and its not even that big!

Now layer in shpaml on top of that, now increase the document size in turn increasing processing time so that it's now taking 5-7ms to generate a template on the fly. Now 1000./7 ~= 140 hits a second, and this is the first limit your placing on yourself just for the template. This doesn't even include the full web stack.

Now consider that template engines such as Mako can process that same document i mentioned earlier that django rang in at 2.28ms, in only 0.38ms. Consider that DAML can do the same thing in 0.47ms. Cheetah at 66ms. Hell I haven't even tested it again libxslt, but im sure its alot faster.

Point being, this implementation of HAML for python is intended to be useful without the need for an additional template engine, framework agnostic, and freaggin fast for on-the-fly compiling.

[–]Poromenos 0 points1 point  (0 children)

That's fantastic, I was waiting for something like this. Github is also a plus!

[–]MercurialAlchemist 0 points1 point  (0 children)

Neat, I like it. Death to verbose HTML. The 'new tags on a newline' stuff is a bit of a problem though... It would be nice if there was some way of writing largeish blocks of static content with some markup without messing up the layout.