From adfc4299a872d1bc571eb7d4be2db8bc010fb10a Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 27 May 2009 22:20:56 +0200 Subject: doc: Document `pie' markups. * doc/user/pie.skb (Syntax): Document markups. * src/guile/skribilo/package/pie.scm (pie, slice, sliceweight): Add `:class' option. (pie, slice, sliceweight)[writers]: Add `:options'. --- src/guile/skribilo/package/pie.scm | 11 ++++++++--- src/guile/skribilo/package/pie/lout.scm | 4 +++- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/guile/skribilo/package/pie.scm b/src/guile/skribilo/package/pie.scm index f99c725..2834076 100644 --- a/src/guile/skribilo/package/pie.scm +++ b/src/guile/skribilo/package/pie.scm @@ -44,7 +44,7 @@ ;;; (define-markup (pie :rest opts - :key (ident #f) (title "Pie Chart") + :key (ident #f) (class "pie") (title "Pie Chart") (initial-angle 0) (total #f) (radius 3) (fingers? #t) (labels 'outside) (class "pie")) @@ -56,7 +56,8 @@ (body (the-body opts)))) (define-markup (slice :rest opts - :key (ident #f) (weight 1) (color "white") (detach? #f)) + :key (ident #f) (class "pie-slice") + (weight 1) (color "white") (detach? #f)) (new container (markup 'slice) (ident (or ident (symbol->string (gensym "slice")))) @@ -68,7 +69,8 @@ (body (the-body opts)))) (define-markup (sliceweight :rest opts - :key (ident #f) (percentage? #f)) + :key (ident #f) (class "pie-sliceweight") + (percentage? #f)) (new markup (markup 'sliceweight) (ident (or ident (symbol->string (gensym "sliceweight")))) @@ -251,6 +253,7 @@ the string \"hello\". Implement `sliceweight' markups too." `("colors: " ,@colors "\n"))))) (markup-writer 'pie (find-engine 'base) + :options '(:title :initial-angle :total :radius :labels) :action (lambda (node engine) (let* ((fmt (select-output-format engine)) (pie-file (string-append (markup-ident node) "." @@ -291,11 +294,13 @@ the string \"hello\". Implement `sliceweight' markups too." engine)))) (markup-writer 'slice (find-engine 'base) + :options '(:weight :color :detach?) :action (lambda (node engine) ;; Nothing to do here (error "slice: this writer should never be invoked"))) (markup-writer 'sliceweight (find-engine 'base) + :options '(:percentage?) :action (lambda (node engine) ;; Nothing to do here. (error "sliceweight: this writer should never be invoked"))) diff --git a/src/guile/skribilo/package/pie/lout.scm b/src/guile/skribilo/package/pie/lout.scm index fe3c674..085cfc2 100644 --- a/src/guile/skribilo/package/pie/lout.scm +++ b/src/guile/skribilo/package/pie/lout.scm @@ -1,6 +1,6 @@ ;;; lout.scm -- Lout implementation of the `pie' package. ;;; -;;; Copyright 2005, 2006, 2007 Ludovic Courtès +;;; Copyright 2005, 2006, 2007, 2009 Ludovic Courtès ;;; ;;; ;;; This program is free software; you can redistribute it and/or modify @@ -49,6 +49,7 @@ ;;; (markup-writer 'pie (find-engine 'lout) + :options '(:title :initial-angle :total :radius :labels :fingers?) :before (lambda (node engine) (let* ((weights (map (lambda (slice) (markup-option slice :weight)) @@ -121,6 +122,7 @@ (markup-writer 'sliceweight (find-engine 'base) ;; This writer should work for every engine, provided the `pie' markup has ;; a proper `&total-weight' option. + :options '(:percentage?) :action (lambda (node engine) (let ((pct? (markup-option node :percentage?))) (output (number->string -- cgit v1.2.3