From 1f6755a36658eb0a926ad85a61dc3c14ab3135e3 Mon Sep 17 00:00:00 2001 From: Sean Brant Date: Mon, 11 Mar 2013 21:53:56 -0500 Subject: Fixes modifier classes inside styleguideblocks --- examples/djangoproject/djangoproject/templates/styleguide.html | 4 ++-- pykss/contrib/django/templatetags/pykss.py | 6 +++--- tests/test_contrib/test_django/test_templatetags/test_pykss.py | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/djangoproject/djangoproject/templates/styleguide.html b/examples/djangoproject/djangoproject/templates/styleguide.html index 2aa6500..1817a27 100644 --- a/examples/djangoproject/djangoproject/templates/styleguide.html +++ b/examples/djangoproject/djangoproject/templates/styleguide.html @@ -14,7 +14,7 @@ {% endcomment %} {% styleguideblock styleguide "1.1" %} - + {% endstyleguideblock %} {% verbatim %} @@ -22,7 +22,7 @@
     
 {% styleguideblock styleguide "1.1" %}
-    <button class="{{ modifier.class_name }}">Example Button</button>
+    <button class="{{ modifier_class }}">Example Button</button>
 {% endstyleguideblock %}
     
 
diff --git a/pykss/contrib/django/templatetags/pykss.py b/pykss/contrib/django/templatetags/pykss.py index a99c3ab..a5ad0d5 100644 --- a/pykss/contrib/django/templatetags/pykss.py +++ b/pykss/contrib/django/templatetags/pykss.py @@ -35,7 +35,7 @@ class StyleguideBlockNode(template.Node): modifier_examples = [] for modifier in section.modifiers: - context.update({'modifier': modifier}) + context.update({'modifier_class': ' %s' % modifier.class_name}) html = self.nodelist.render(context).strip() modifier_examples.append({ 'modifier': modifier, @@ -56,11 +56,11 @@ class StyleguideBlockNode(template.Node): def styleguideblock(parser, token): """ {% styleguideblock styleguide "1.1" %} - + {% endstyleguideblock %} {% styleguideblock styleguide "1.1" using "custom.html" %} - + {% endstyleguideblock %} """ diff --git a/tests/test_contrib/test_django/test_templatetags/test_pykss.py b/tests/test_contrib/test_django/test_templatetags/test_pykss.py index dc48e41..f066499 100644 --- a/tests/test_contrib/test_django/test_templatetags/test_pykss.py +++ b/tests/test_contrib/test_django/test_templatetags/test_pykss.py @@ -79,7 +79,7 @@ class StyleguideBlockTestCase(TestCase): template = Template(""" {% load pykss %} {% styleguideblock styleguide "2.1.1" using "django.html" %} - + {% endstyleguideblock %} """) context = Context({'styleguide': self.styleguide}) @@ -88,6 +88,6 @@ class StyleguideBlockTestCase(TestCase): self.assertEqual(results['filename'], 'buttons.css') self.assertEqual(results['description'], 'Your standard form button.') self.assertEqual(results['modifiers'][0], [':hover', 'Highlights when hovering.']) - self.assertEqual(results['example_html'], '') - self.assertEqual(results['modifier_examples'][0], [':hover', '']) - self.assertEqual(results['escaped_html'], '<i class=""></i>') + self.assertEqual(results['example_html'], '') + self.assertEqual(results['modifier_examples'][0], [':hover', '']) + self.assertEqual(results['escaped_html'], '<i class="main"></i>') -- cgit v1.2.3