Browse Source

Merge all css in one tag as a workaround for inkscape one style tag bug. Fixes #7

pull/35/merge
Florian Mounier 12 years ago
parent
commit
133df7ab07
  1. 2
      demo/moulinrouge/__init__.py
  2. 4
      pygal/svg.py

2
demo/moulinrouge/__init__.py

@ -96,7 +96,7 @@ def create_app():
@app.route("/sparkline/<style>")
def sparkline(style):
line = pygal.Line(style=styles[style])
line = pygal.Line(style=styles[style], pretty_print=True)
line.add('_', [random.randrange(0, 10) for _ in range(25)])
return Response(
line.render_sparkline(height=40), mimetype='image/svg+xml')

4
pygal/svg.py

@ -60,6 +60,7 @@ class Svg(object):
def add_styles(self):
"""Add the css to the svg"""
all_css = []
for css in ['base.css'] + list(self.graph.css):
if urlparse(css).scheme:
self.processing_instructions.append(
@ -76,8 +77,9 @@ class Svg(object):
font_sizes=self.graph.font_sizes())
if not self.graph.pretty_print:
css_text = minify_css(css_text)
all_css.append(css_text)
self.node(
self.defs, 'style', type='text/css').text = css_text
self.defs, 'style', type='text/css').text = '\n'.join(all_css)
def add_scripts(self):
"""Add the js to the svg"""

Loading…
Cancel
Save