diff options
-rw-r--r-- | ChangeLog | 22 | ||||
-rw-r--r-- | src/guile/skribilo/package/eq.scm | 29 | ||||
-rw-r--r-- | src/guile/skribilo/package/eq/lout.scm | 25 |
3 files changed, 73 insertions, 3 deletions
@@ -2,6 +2,28 @@ # arch-tag: automatic-ChangeLog--skribilo@sv.gnu.org--2006/skribilo--devo--1.2 # +2007-03-16 17:11:30 GMT Ludovic Court`es <ludovic.courtes@laas.fr> patch-67 + + Summary: + `eq' package: Added `eq:set'. + Revision: + skribilo--devo--1.2--patch-67 + + * src/guile/skribilo/package/eq.scm: Use `(srfi srfi-1)'. + (%operators): Added `set'. + (eq:set): New. New writer. + + * src/guile/skribilo/package/eq/lout.scm: Use `srfi-1'. + (eq:set): New writer. + + modified files: + ChangeLog src/guile/skribilo/package/eq.scm + src/guile/skribilo/package/eq/lout.scm + + new patches: + lcourtes@laas.fr--2006-libre/skribilo--devo--1.2--patch-26 + + 2007-03-16 17:10:38 GMT Ludovic Court`es <ludovic.courtes@laas.fr> patch-66 Summary: diff --git a/src/guile/skribilo/package/eq.scm b/src/guile/skribilo/package/eq.scm index cadc1ba..af2c906 100644 --- a/src/guile/skribilo/package/eq.scm +++ b/src/guile/skribilo/package/eq.scm @@ -1,6 +1,6 @@ ;;; eq.scm -- An equation formatting package. ;;; -;;; Copyright 2005, 2006 Ludovic Courtès <ludovic.courtes@laas.fr> +;;; Copyright 2005, 2006, 2007 Ludovic Courtès <ludovic.courtes@laas.fr> ;;; ;;; ;;; This program is free software; you can redistribute it and/or modify @@ -30,6 +30,7 @@ :autoload (skribilo package base) (it symbol sub sup) :autoload (skribilo engine lout) (lout-illustration) + :use-module (srfi srfi-1) :use-module (srfi srfi-39) :use-module (ice-9 optargs)) @@ -61,7 +62,7 @@ (define %operators '(/ * + - = != ~= < > <= >= sqrt expt sum product script - in notin apply limit combinations)) + in notin apply limit combinations set)) (define %symbols ;; A set of symbols that are automatically recognized within an `eq' quoted @@ -330,6 +331,13 @@ a symbol representing the mathematical operator denoted by @var{m} (e.g., ,@(the-options opts :ident))) (body (the-body opts)))) +(define-markup (eq:set :rest opts :key (ident #f)) + (new markup + (markup 'eq:set) + (ident (or ident (symbol->string (gensym "eq:set")))) + (options '()) + (body (the-body opts)))) + ;;; ;;; Text-based rendering. @@ -533,6 +541,23 @@ a symbol representing the mathematical operator denoted by @var{m} (e.g., (output among engine) (display ")")))) +(markup-writer 'eq:set (find-engine 'base) + ;; Take the elements of the set and enclose them into braces. + :action (lambda (node engine) + (define (printable elem) + (if (eq? elem '...) + (symbol "ellipsis") + elem)) + + (output "{ " engine) + (pair-for-each (lambda (pair) + (let ((elem (printable (car pair)))) + (output elem engine) + (if (not (null? (cdr pair))) + (output ", " engine)))) + (markup-body node)) + (output " }" engine))) + ;;; diff --git a/src/guile/skribilo/package/eq/lout.scm b/src/guile/skribilo/package/eq/lout.scm index 21e8f92..5633ae4 100644 --- a/src/guile/skribilo/package/eq/lout.scm +++ b/src/guile/skribilo/package/eq/lout.scm @@ -1,6 +1,6 @@ ;;; lout.scm -- Lout implementation of the `eq' package. ;;; -;;; Copyright 2005, 2006 Ludovic Courtès <ludovic.courtes@laas.fr> +;;; Copyright 2005, 2006, 2007 Ludovic Courtès <ludovic.courtes@laas.fr> ;;; ;;; ;;; This program is free software; you can redistribute it and/or modify @@ -27,6 +27,7 @@ :use-module (skribilo lib) :use-module (skribilo utils syntax) :use-module (skribilo utils keywords) ;; `the-options', etc. + :use-module (srfi srfi-1) :use-module (ice-9 optargs)) (fluid-set! current-reader %skribilo-module-reader) @@ -293,5 +294,27 @@ (display " } "))) (display " } ")))) + +;;; +;;; Sets. +;;; + +(markup-writer 'eq:set (find-engine 'lout) + ;; Take the elements of the set and enclose them into braces. + :action (lambda (node engine) + (define (printable elem) + (if (eq? elem '...) + (symbol "ellipsis") + elem)) + + (display " brmatrix { ") + (pair-for-each (lambda (pair) + (let ((elem (printable (car pair)))) + (output elem engine) + (if (not (null? (cdr pair))) + (output ", " engine)))) + (markup-body node)) + (display " } "))) + ;;; arch-tag: 2a1410e5-977e-4600-b781-3d57f4409b35 |