aboutsummaryrefslogtreecommitdiffstats
path: root/nikola/plugins/compile/rest/chart.py
diff options
context:
space:
mode:
authorLibravatarAgustin Henze <tin@sluc.org.ar>2015-08-26 07:57:23 -0300
committerLibravatarAgustin Henze <tin@sluc.org.ar>2015-08-26 07:57:23 -0300
commit70ceb871117ca811d63cb02671dc0fefc2700883 (patch)
tree846133ea39797d2cd1101cff2ac0818167353490 /nikola/plugins/compile/rest/chart.py
parent8559119e2f45b7f6508282962c0430423bfab051 (diff)
parent787b97a4cb24330b36f11297c6d3a7a473a907d0 (diff)
Merge tag 'upstream/7.6.4'
Upstream version 7.6.4
Diffstat (limited to 'nikola/plugins/compile/rest/chart.py')
-rw-r--r--nikola/plugins/compile/rest/chart.py25
1 files changed, 16 insertions, 9 deletions
diff --git a/nikola/plugins/compile/rest/chart.py b/nikola/plugins/compile/rest/chart.py
index 59b9dc7..88fdff3 100644
--- a/nikola/plugins/compile/rest/chart.py
+++ b/nikola/plugins/compile/rest/chart.py
@@ -24,6 +24,8 @@
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+"""Chart directive for reSTructuredText."""
+
from ast import literal_eval
from docutils import nodes
@@ -42,9 +44,12 @@ _site = None
class Plugin(RestExtension):
+ """Plugin for chart role."""
+
name = "rest_chart"
def set_site(self, site):
+ """Set Nikola site."""
global _site
_site = self.site = site
directives.register_directive('chart', Chart)
@@ -52,17 +57,18 @@ class Plugin(RestExtension):
class Chart(Directive):
- """ Restructured text extension for inserting charts as SVG
- Usage:
- .. chart:: Bar
- :title: 'Browser usage evolution (in %)'
- :x_labels: ["2002", "2003", "2004", "2005", "2006", "2007"]
+ """reStructuredText extension for inserting charts as SVG.
+
+ Usage:
+ .. chart:: Bar
+ :title: 'Browser usage evolution (in %)'
+ :x_labels: ["2002", "2003", "2004", "2005", "2006", "2007"]
- 'Firefox', [None, None, 0, 16.6, 25, 31]
- 'Chrome', [None, None, None, None, None, None]
- 'IE', [85.8, 84.6, 84.7, 74.5, 66, 58.6]
- 'Others', [14.2, 15.4, 15.3, 8.9, 9, 10.4]
+ 'Firefox', [None, None, 0, 16.6, 25, 31]
+ 'Chrome', [None, None, None, None, None, None]
+ 'IE', [85.8, 84.6, 84.7, 74.5, 66, 58.6]
+ 'Others', [14.2, 15.4, 15.3, 8.9, 9, 10.4]
"""
has_content = True
@@ -129,6 +135,7 @@ class Chart(Directive):
}
def run(self):
+ """Run the directive."""
if pygal is None:
msg = req_missing(['pygal'], 'use the Chart directive', optional=True)
return [nodes.raw('', '<div class="text-error">{0}</div>'.format(msg), format='html')]