summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLudovic Court`es2006-02-17 13:21:55 +0000
committerLudovic Court`es2006-02-17 13:21:55 +0000
commit60531ac43e86c0cfdc6163eed3aeb656aaa56720 (patch)
tree23dd4c2fd204b533b60d62e2509a877ed141ae21 /src
parent11105691c17ed25fa743680cdbae1c9ff3b8cd78 (diff)
downloadskribilo-60531ac43e86c0cfdc6163eed3aeb656aaa56720.tar.gz
skribilo-60531ac43e86c0cfdc6163eed3aeb656aaa56720.tar.lz
skribilo-60531ac43e86c0cfdc6163eed3aeb656aaa56720.zip
`eq' package: added the `script' markup.
* src/guile/skribilo/package/eq.scm (%operators): Added `script'. (eq:script): New. (eq:expt): Fixed wrong braces. git-archimport-id: lcourtes@laas.fr--2004-libre/skribilo--devel--1.2--patch-48
Diffstat (limited to 'src')
-rw-r--r--src/guile/skribilo/package/eq.scm40
1 files changed, 35 insertions, 5 deletions
diff --git a/src/guile/skribilo/package/eq.scm b/src/guile/skribilo/package/eq.scm
index 1ac8d35..9be8f61 100644
--- a/src/guile/skribilo/package/eq.scm
+++ b/src/guile/skribilo/package/eq.scm
@@ -50,7 +50,7 @@
;;;
(define %operators
- '(/ * + - = != ~= < > <= >= sqrt expt sum product))
+ '(/ * + - = != ~= < > <= >= sqrt expt sum product script))
(define %rebindings
(map (lambda (sym)
@@ -129,6 +129,14 @@
(options (the-options opts))
(body (the-body opts))))
+(define-markup (eq:script :rest opts :key (ident #f) (class "eq:script")
+ (sub #f) (sup #f))
+ (new markup
+ (markup 'eq:script)
+ (ident (or ident (symbol->string (gensym "eq:script"))))
+ (options (the-options opts))
+ (body (the-body opts))))
+
;;;
@@ -216,11 +224,14 @@
:action (lambda (node engine)
(let ((body (markup-body node)))
(if (= (length body) 2)
- (begin
+ (let ((base (car body))
+ (expt (cadr body)))
(display " { { ")
- (output (car body) engine)
+ (if (markup? base) (display "("))
+ (output base engine)
+ (if (markup? base) (display ")"))
(display " } sup { ")
- (output (cadr body) engine)
+ (output expt engine)
(display " } } "))
(skribe-error 'eq:expt "wrong number of arguments"
body)))))
@@ -243,11 +254,30 @@
(output to engine)
(display " } { ")
(output body engine)
- (display " } ")))))
+ (display " } } ")))))
(range-lout-markup-writer sum "sum")
(range-lout-markup-writer product "prod")
+(markup-writer 'eq:script (find-engine 'lout)
+ :action (lambda (node engine)
+ (let ((body (markup-body node))
+ (sup (markup-option node :sup))
+ (sub (markup-option node :sub)))
+ (display " { { ")
+ (output body engine)
+ (display " } ")
+ (if sup
+ (begin
+ (display (if sub " supp { " " sup { "))
+ (output sup engine)
+ (display " } ")))
+ (if sub
+ (begin
+ (display " on { ")
+ (output sub engine)
+ (display " } ")))
+ (display " } "))))
;;;