summaryrefslogtreecommitdiff
path: root/src/guile
diff options
context:
space:
mode:
authorLudovic Courtes2006-12-03 21:53:41 +0000
committerLudovic Courtes2006-12-03 21:53:41 +0000
commit7996e5b2dddf1321d03b52635367a90cefa85c8d (patch)
treebd9b155c463b5f840aee1290965251ba6cbc2f2b /src/guile
parent1eecf11d36df1ec53f22f9882199abf481bd7494 (diff)
downloadskribilo-7996e5b2dddf1321d03b52635367a90cefa85c8d.tar.gz
skribilo-7996e5b2dddf1321d03b52635367a90cefa85c8d.tar.lz
skribilo-7996e5b2dddf1321d03b52635367a90cefa85c8d.zip
eq: Support automatic detection of inlining.
* src/guile/skribilo/package/eq.scm (inline-equation?): New. (eq)[inline?]: Default to `auto'. * src/guile/skribilo/package/eq/lout.scm (eq): Use `inline-equation?'. git-archimport-id: skribilo@sv.gnu.org--2006/skribilo--devo--1.2--patch-32
Diffstat (limited to 'src/guile')
-rw-r--r--src/guile/skribilo/package/eq.scm16
-rw-r--r--src/guile/skribilo/package/eq/lout.scm2
2 files changed, 15 insertions, 3 deletions
diff --git a/src/guile/skribilo/package/eq.scm b/src/guile/skribilo/package/eq.scm
index e783c89..cadc1ba 100644
--- a/src/guile/skribilo/package/eq.scm
+++ b/src/guile/skribilo/package/eq.scm
@@ -19,7 +19,7 @@
;;; USA.
(define-module (skribilo package eq)
- :autoload (skribilo ast) (markup?)
+ :autoload (skribilo ast) (markup? find-up)
:autoload (skribilo output) (output)
:use-module (skribilo writer)
:use-module (skribilo engine)
@@ -117,6 +117,18 @@ a symbol representing the mathematical operator denoted by @var{m} (e.g.,
(string-length str))))
#f))
+(define-public (inline-equation? m)
+ "Return @code{#t} if @var{m} is an equation that is to be displayed inline."
+ (and (is-markup? m 'eq)
+ (let ((i (markup-option m :inline?)))
+ (case i
+ ((auto)
+ (not (find-up (lambda (n)
+ (is-markup? n 'eq-display))
+ m)))
+ ((#t) #t)
+ (else #f)))))
+
;;;
;;; Operator precedence.
@@ -194,7 +206,7 @@ a symbol representing the mathematical operator denoted by @var{m} (e.g.,
(body (the-body opts))))
(define-markup (eq :rest opts :key (ident #f) (class "eq")
- (inline? #f) (align-with #f)
+ (inline? 'auto) (align-with #f)
(renderer #f) (div-style 'over)
(mul-style 'space))
(new container
diff --git a/src/guile/skribilo/package/eq/lout.scm b/src/guile/skribilo/package/eq/lout.scm
index 2c7b1bb..e08e6d1 100644
--- a/src/guile/skribilo/package/eq/lout.scm
+++ b/src/guile/skribilo/package/eq/lout.scm
@@ -64,7 +64,7 @@
(if (and displayed? (not (*embedded-renderer*)))
"\n@IAD " ""))))
:action (lambda (node engine)
- (display (if (markup-option node :inline?)
+ (display (if (inline-equation? node)
"@E { "
"@Eq { "))
(let ((eq (markup-body node)))