Permalink
Browse files

adding alt tags for images.

  • Loading branch information...
1 parent 4295c21 commit 3c2a1c406d423649dac23fd12799a4fb11a63e12 @chrisdrackett chrisdrackett committed Aug 2, 2009
Showing with 3 additions and 7 deletions.
  1. +1 −1 docs/examples.txt
  2. +2 −6 templatetags/charts.py
View
@@ -27,7 +27,7 @@ Line chart, legend, fill, colors, saving as a variable
{% chart-fill "EEEEEE" %}
{% chart-legend "Sweet" %}
{% endchart %}
- <img src="{{ c.url }}" width="300" height="200">
+ <img src="{{ c.url }}" width="300" height="200" />
Titles, multiple colors, background
-----------------------------------
View
@@ -55,7 +55,7 @@ def sparkline(data, size="100x30", color=_chart_color):
chxs=0,990000,11,0,_|1,990000,1,0,_|2,990000,1,0,_&\
chxl=0:|%s|1:||2:||&\
chxp=0,%s\
- ">' % (encoded_data, color, len(data), data[-1], 100*(float(data[-1])/(maxvalue-minvalue)))
+ " alt="" />' % (encoded_data, color, len(data), data[-1], 100*(float(data[-1])/(maxvalue-minvalue)))
#
# {% chart %}
@@ -167,11 +167,7 @@ def img(self, color_override = None):
if orig_colors:
self.options['chco'] = orig_colors
width, height = self.options["chs"].split("x")
- if self.alt:
- alt = 'alt="%s" ' % escape(self.alt)
- else:
- alt = ''
- s = mark_safe('<img src="%s" width="%s" height="%s" %s>' % (escape(url), width, height, alt))
+ s = mark_safe('<img src="%s" width="%s" height="%s" alt="%s" />' % (escape(url), width, height, escape(alt)))
return s

0 comments on commit 3c2a1c4

Please sign in to comment.