Skip to content
Permalink
Browse files
Implement invariance in charts properly
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Aug 25, 2015
1 parent 4b05d26 commit 84f62cbfaab8ed51854f127e3318d5b822437f64
Showing with 2 additions and 4 deletions.
  1. +2 −4 nikola/plugins/compile/rest/chart.py
@@ -152,13 +152,11 @@ def run(self):
options[k] = literal_eval(v)

chart = getattr(pygal, self.arguments[0])(style=style)
if _site and _site.invariant:
chart.no_prefix = True
chart.config(**options)
for line in self.content:
label, series = literal_eval('({0})'.format(line))
chart.add(label, series)
data = chart.render().decode('utf8')
if _site and _site.invariant:
import re
data = re.sub('id="chart-[a-f0-9\-]+"', 'id="chart-foobar"', data)
data = re.sub('#chart-[a-f0-9\-]+', '#chart-foobar', data)
return [nodes.raw('', data, format='html')]

0 comments on commit 84f62cb

Please sign in to comment.