summaryrefslogtreecommitdiffstats
path: root/nikola/plugins/compile/rest/chart.py
diff options
context:
space:
mode:
authorLibravatarDererk <dererk@debian.org>2015-11-11 16:34:34 -0300
committerLibravatarDererk <dererk@debian.org>2015-11-11 16:34:34 -0300
commit4e3224c012df9f74f010eb92203520515e8537b9 (patch)
tree19322dc0c595268cb6864f21d7e92fd93cb826e9 /nikola/plugins/compile/rest/chart.py
parent787b97a4cb24330b36f11297c6d3a7a473a907d0 (diff)
Imported Upstream version 7.7.3upstream/7.7.3
Diffstat (limited to 'nikola/plugins/compile/rest/chart.py')
-rw-r--r--nikola/plugins/compile/rest/chart.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/nikola/plugins/compile/rest/chart.py b/nikola/plugins/compile/rest/chart.py
index 88fdff3..ed8a250 100644
--- a/nikola/plugins/compile/rest/chart.py
+++ b/nikola/plugins/compile/rest/chart.py
@@ -43,7 +43,6 @@ _site = None
class Plugin(RestExtension):
-
"""Plugin for chart role."""
name = "rest_chart"
@@ -57,7 +56,6 @@ class Plugin(RestExtension):
class Chart(Directive):
-
"""reStructuredText extension for inserting charts as SVG.
Usage:
@@ -150,15 +148,15 @@ class Chart(Directive):
style = getattr(pygal.style, style_name)
for k, v in self.options.items():
options[k] = literal_eval(v)
-
- chart = getattr(pygal, self.arguments[0])(style=style)
+ chart = pygal
+ for o in self.arguments[0].split('.'):
+ chart = getattr(chart, o)
+ chart = chart(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')]