boscoh / tohaml

converts HTML to HAML for the HamlPy compiler
3 stars 2 forks source link

does not convert html snippets #2

Open davidtingsu opened 10 years ago

davidtingsu commented 10 years ago

Input

{% extends parent %}
{% load static from staticfiles %}
{% block primary %}
{% if sites %}
<h2>Work Sites</h2>
{% for site in sites %}
    <p><a href='/sites/#{{site.id}}' data-use-pjax>{{site.location.name}}</a></p>
{% endfor %}
{% endif %}
{% endblock %}

Output

None

Expected

- extends parent
- load static from staticfiles 
- block primary
- if sites 
   %h2 
     Work Sites
- for site in sites 
  %p
    %a{ 'href':'/sites/#{{site.id}}', data-use-pjax:'' }
     {{site.location.name}}
boscoh commented 10 years ago

Sorry I didn't make it clear, it only converts HTML, and not JINJA2/DJANGO-HTML templates to HAML. This is because I use BeautifulSoup for the parsing.