Use the safe filter for inline content and respect the use of the media attribute on inline style if available.

This commit is contained in:
Benjamin Wohlwend
2010-03-16 13:58:40 +01:00
committed by Jannis Leidel
parent 35cd608239
commit c3fab9b01b
3 changed files with 6 additions and 3 deletions

View File

@@ -152,7 +152,10 @@ class Compressor(object):
return render_to_string(self.template_name, context)
def output_inline(self):
return render_to_string(self.template_name_inline, {'content': settings.COMPRESS and self.combined or self.concat()})
context = {'content': settings.COMPRESS and self.combined or self.concat()}
if hasattr(self, 'extra_context'):
context.extend(self.extra_context)
return render_to_string(self.template_name_inline, context)
class CssCompressor(Compressor):

View File

@@ -1 +1 @@
<style type="text/css">{{ content }}</style>
<style type="text/css"{% if media %} media="{{ media }}"{% endif %}>{{ content|safe }}</style>

View File

@@ -1 +1 @@
<script type="text/javascript">{{ content }}</script>
<script type="text/javascript">{{ content|safe }}</script>