Skip to content

Commit

Permalink
Implement invariance in charts properly
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Aug 25, 2015
1 parent 4b05d26 commit 84f62cb
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions nikola/plugins/compile/rest/chart.py
Expand Up @@ -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.