diff --git a/imagekit/templatetags/imagekit.py b/imagekit/templatetags/imagekit.py index 8a59242..67d2438 100644 --- a/imagekit/templatetags/imagekit.py +++ b/imagekit/templatetags/imagekit.py @@ -10,7 +10,7 @@ register = template.Library() ASSIGNMENT_DELIMETER = 'as' -HTML_ATTRS_DELIMITER = 'with' +HTML_ATTRS_DELIMITER = '--' DEFAULT_THUMBNAIL_GENERATOR = 'ik:thumbnail' @@ -205,10 +205,10 @@ def generateimage(parser, token): - You can add additional attributes to the tag using "with". For example, + You can add additional attributes to the tag using "--". For example, this:: - {% generateimage 'myapp:thumbnail' from=mymodel.profile_image with alt="Hello!" %} + {% generateimage 'myapp:thumbnail' from=mymodel.profile_image -- alt="Hello!" %} will result in the following markup:: @@ -250,7 +250,7 @@ def thumbnail(parser, token): {% generateimage 'ik:thumbnail' from=mymodel.profile_image width=100 height=100 %} - The thumbnail tag supports the "with" and "as" bits for adding html + The thumbnail tag supports the "--" and "as" bits for adding html attributes and assigning to a variable, respectively. It also accepts the kwargs "anchor", and "crop". diff --git a/tests/test_generateimage_tag.py b/tests/test_generateimage_tag.py index 12f8d4b..18b4168 100644 --- a/tests/test_generateimage_tag.py +++ b/tests/test_generateimage_tag.py @@ -14,25 +14,25 @@ def test_img_tag(): def test_img_tag_attrs(): - ttag = r"""{% generateimage 'testspec' from=img with alt="Hello" %}""" + ttag = r"""{% generateimage 'testspec' from=img -- alt="Hello" %}""" attrs = get_html_attrs(ttag) eq_(attrs.get('alt'), 'Hello') @raises(TemplateSyntaxError) -def test_dangling_with(): - ttag = r"""{% generateimage 'testspec' from=img with %}""" +def test_dangling_html_attrs_delimiter(): + ttag = r"""{% generateimage 'testspec' from=img -- %}""" render_tag(ttag) @raises(TemplateSyntaxError) -def test_with_assignment(): +def test_html_attrs_assignment(): """ You can either use generateimage as an assigment tag or specify html attrs, but not both. """ - ttag = r"""{% generateimage 'testspec' from=img with alt="Hello" as th %}""" + ttag = r"""{% generateimage 'testspec' from=img -- alt="Hello" as th %}""" render_tag(ttag) @@ -41,7 +41,7 @@ def test_single_dimension_attr(): If you only provide one of width or height, the other should not be added. """ - ttag = r"""{% generateimage 'testspec' from=img with width="50" %}""" + ttag = r"""{% generateimage 'testspec' from=img -- width="50" %}""" attrs = get_html_attrs(ttag) assert_not_in('height', attrs) diff --git a/tests/test_thumbnail_tag.py b/tests/test_thumbnail_tag.py index 235bb1b..e31304a 100644 --- a/tests/test_thumbnail_tag.py +++ b/tests/test_thumbnail_tag.py @@ -14,14 +14,14 @@ def test_img_tag(): def test_img_tag_attrs(): - ttag = r"""{% thumbnail '100x100' img with alt="Hello" %}""" + ttag = r"""{% thumbnail '100x100' img -- alt="Hello" %}""" attrs = get_html_attrs(ttag) eq_(attrs.get('alt'), 'Hello') @raises(TemplateSyntaxError) -def test_dangling_with(): - ttag = r"""{% thumbnail '100x100' img with %}""" +def test_dangling_html_attrs_delimiter(): + ttag = r"""{% thumbnail '100x100' img -- %}""" render_tag(ttag) @@ -38,13 +38,13 @@ def test_too_many_args(): @raises(TemplateSyntaxError) -def test_with_assignment(): +def test_html_attrs_assignment(): """ You can either use thumbnail as an assigment tag or specify html attrs, but not both. """ - ttag = r"""{% thumbnail '100x100' img with alt="Hello" as th %}""" + ttag = r"""{% thumbnail '100x100' img -- alt="Hello" as th %}""" render_tag(ttag)