Skip to content

Conversation

@deanmalmgren
Copy link

I tend to embed inline javascript snippets by using {% include %} django template tags like this:

-# template.haml
!!! 5
%html
    %body
        %p hello world
        %script
            {% autoescape off %}
            {% include "path/to/file.js" %}
            {% endautoescape %}

This is convenient because my editor can then use the appropriate javascript syntax highlighting rather than the haml syntax highlighting. The problem is that this produces a RuntimeError (maximum recursion dept exceeded while calling a Python object) for any templates that are {% include %}-ed but do not end in one of the hamlpy.VALID_EXTENSIONS. Bummer.

I might recommend making VALID_EXTENSIONS a settings variable within the hamlpy app that can easily be extended in the site settings.py.

@jpesce
Copy link

jpesce commented Dec 26, 2013

+1

Dean Malmgren added 2 commits January 2, 2014 17:29
@deanmalmgren
Copy link
Author

I took a stab at incorporating this in a manner similar to how HAMLPY_ATTR_WRAPPER is written. I didn't see any tests for HAMLPY_ATTR_WRAPPER so I wasn't sure the best way to add tests for this new functionality. If you have any suggestions, etc, I'm happy to modify accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants