diff options
| author | 2014-06-13 21:51:02 -0300 | |
|---|---|---|
| committer | 2014-06-13 21:51:02 -0300 | |
| commit | 58c4878526dec5510f23c812274686787d8724ba (patch) | |
| tree | 5f2374bc17adb10e15f7e5b4576595d9cc2ef17e /nikola/plugins/compile/rest/chart.py | |
| parent | fa50632a9d87c3989566fed3e49c160a132e0d14 (diff) | |
Imported Upstream version 7.0.1upstream/7.0.1
Diffstat (limited to 'nikola/plugins/compile/rest/chart.py')
| -rw-r--r-- | nikola/plugins/compile/rest/chart.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/nikola/plugins/compile/rest/chart.py b/nikola/plugins/compile/rest/chart.py index 03878a3..55ddf5c 100644 --- a/nikola/plugins/compile/rest/chart.py +++ b/nikola/plugins/compile/rest/chart.py @@ -37,13 +37,16 @@ except ImportError: from nikola.plugin_categories import RestExtension from nikola.utils import req_missing +_site = None + class Plugin(RestExtension): name = "rest_chart" def set_site(self, site): - self.site = site + global _site + _site = self.site = site directives.register_directive('chart', Chart) return super(Plugin, self).set_site(site) @@ -146,5 +149,9 @@ class Chart(Directive): for line in self.content: label, series = literal_eval('({0})'.format(line)) chart.add(label, series) - - return [nodes.raw('', chart.render().decode('utf8'), format='html')] + 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')] |
