diff options
author | Ludovic Courtès | 2012-05-17 23:37:43 +0200 |
---|---|---|
committer | Ludovic Courtès | 2012-05-17 23:37:43 +0200 |
commit | 1c445dd093cb6a02289f25324039ce1cba358145 (patch) | |
tree | e420e91ef8345c6918af7133911a58c9746dcfc8 /src/guile/skribilo/package/base.scm | |
parent | f59dc186a84504715faf141d1d7bcc9e3ca9d2e7 (diff) | |
download | skribilo-1c445dd093cb6a02289f25324039ce1cba358145.tar.gz skribilo-1c445dd093cb6a02289f25324039ce1cba358145.tar.lz skribilo-1c445dd093cb6a02289f25324039ce1cba358145.zip |
Change `define-markup' to generate a macro, to capture location syntactically.
* src/guile/skribilo/lib.scm (dsssl->guile-formals): New procedure,
formerly `fix-rest-arg' procedure in `define-markup'.
(define-markup)[guile-2]: Turn into a macro-generating macro, such
that markups capture their invocation location syntactically.
* src/guile/skribilo/location.scm (source-properties->location): New
procedure.
(invocation-location): Use it.
* src/guile/skribilo/package/base.scm (handle): Move above first use,
since it's now a macro on Guile 2.0.
* src/guile/skribilo/package/slide.scm (slide-vspace): Likewise.
* src/guile/skribilo/package/eq.scm: Use (skribilo package base) instead
of autoloading it.
* tests/Makefile.am (TESTS): Add `location.test'.
* tests/location.test: New file.
Diffstat (limited to 'src/guile/skribilo/package/base.scm')
-rw-r--r-- | src/guile/skribilo/package/base.scm | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/src/guile/skribilo/package/base.scm b/src/guile/skribilo/package/base.scm index 52ce6c9..60eccb1 100644 --- a/src/guile/skribilo/package/base.scm +++ b/src/guile/skribilo/package/base.scm @@ -135,6 +135,31 @@ (body #f)))) ;*---------------------------------------------------------------------*/ +;* handle ... */ +;*---------------------------------------------------------------------*/ +(define-markup (handle :rest opts + :key (ident #f) (class "handle") value section) + (let ((body (the-body opts))) + (cond + (section + (error 'handle "Illegal handle `section' option" section) + (new unresolved + (loc &invocation-location) + (proc (lambda (n e env) + (let ((s (resolve-ident section 'section n env))) + (new handle + (loc &invocation-location) + (ast s))))))) + ((and (pair? body) + (null? (cdr body)) + (markup? (car body))) + (new handle + (loc &invocation-location) + (ast (car body)))) + (else + (skribe-error 'handle "Illegal handle" opts))))) + +;*---------------------------------------------------------------------*/ ;* toc ... */ ;*---------------------------------------------------------------------*/ (define-markup (toc :rest @@ -964,31 +989,6 @@ (define-processor-markup tex-processor) ;*---------------------------------------------------------------------*/ -;* handle ... */ -;*---------------------------------------------------------------------*/ -(define-markup (handle :rest opts - :key (ident #f) (class "handle") value section) - (let ((body (the-body opts))) - (cond - (section - (error 'handle "Illegal handle `section' option" section) - (new unresolved - (loc &invocation-location) - (proc (lambda (n e env) - (let ((s (resolve-ident section 'section n env))) - (new handle - (loc &invocation-location) - (ast s))))))) - ((and (pair? body) - (null? (cdr body)) - (markup? (car body))) - (new handle - (loc &invocation-location) - (ast (car body)))) - (else - (skribe-error 'handle "Illegal handle" opts))))) - -;*---------------------------------------------------------------------*/ ;* mailto ... */ ;* ------------------------------------------------------------- */ ;* doc: */ |