My name is Ram Rachum, and I'm a Python software developer based in Israel.

This is my personal blog. I write about technology, Python, programming and a bunch of other things.

GitHub profile

Personal Website

8th February 2014

Text

I love Shpaml! (HTML abstraction language)

I’m in love with the Shpaml language!

It’s an HTML abstraction language. This means it’s a simple language that can be used instead of HTML in web apps, and is compiled to HTML before being sent to the user. 

The reason I love it so much is because it cuts down on a huge amount of code, and makes HTML feel a little bit more like Python.

For example, this snippet in Shpaml:

html
  body
    div
      h1
        My title
        
      % block content
        p
          My text

Would expand to this HTML code:

<html>
  <body>
    <div>
      <h1>
        My title
      </h1>
      {% block content %}
        <p>
          My text
        </p
      {% endblock content %}
    </div>
  </body>
</html>

Holy shit, that’s an incredible amount of code saved! For the above snippet, we’re talking about 44% less code! (Not counting whitespace.) On an average day I would kill for anything that shortens code by as little as 5%, so you could imagine how excited I am about reducing the size of code by 44%.

Of course, the problem with Shpaml, as with any HTML/JS/CSS abstraction language, is that most developers would be surprised to find it in your project and may be a bit uncomfortable with editing it. But hey, for 44% less code… I’m willing to pay that price :)

Get Shpaml for Django here.

Comments
All content in this website is copyright © 1986-2011 Ram Rachum.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License, with attribution to "Ram Rachum at ram.rachum.com" including link to ram.rachum.com.
To view a copy of this license, visit: http://creativecommons.org/licenses/by-sa/3.0/