From 0c3e59a00b749e4b334bed984a72a68c9a3f8c46 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 27 May 2009 22:23:08 +0200 Subject: pie: Move generic `sliceweight' writer in the right place. * src/guile/skribilo/package/pie.scm (sliceweight): Add generic writer. * src/guile/skribilo/package/pie/lout.scm (sliceweight): Generic writer removed. --- src/guile/skribilo/package/pie.scm | 12 ++++++++---- src/guile/skribilo/package/pie/lout.scm | 11 ----------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/src/guile/skribilo/package/pie.scm b/src/guile/skribilo/package/pie.scm index 2834076..3290665 100644 --- a/src/guile/skribilo/package/pie.scm +++ b/src/guile/skribilo/package/pie.scm @@ -300,10 +300,14 @@ the string \"hello\". Implement `sliceweight' markups too." (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"))) + ;; 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 + (pie-sliceweight-value node pct?)) + engine)))) ;;; diff --git a/src/guile/skribilo/package/pie/lout.scm b/src/guile/skribilo/package/pie/lout.scm index 085cfc2..03d17fe 100644 --- a/src/guile/skribilo/package/pie/lout.scm +++ b/src/guile/skribilo/package/pie/lout.scm @@ -119,14 +119,3 @@ (output (markup-body node) engine) (display " }\n"))) -(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 - (pie-sliceweight-value node pct?)) - engine)))) - -;;; arch-tag: b5221e30-f80e-4b72-a281-83ce19ddb755 -- cgit v1.2.3