From 46122eb2392f848079320e09eda8b747dc9a4177 Mon Sep 17 00:00:00 2001 From: Ludovic Courtes Date: Sun, 1 Jul 2007 23:50:22 +0000 Subject: Fixed and simplified `(ref :line ...)', aka. `line-ref'. * src/guile/skribilo/engine/base.scm (line-ref): Changed the way the number is obtained. * src/guile/skribilo/engine/context.scm (line-ref): Removed. * src/guile/skribilo/engine/html.scm (&prog-line): New. Produce an anchor. Needed because `mark' are no longer produced by `make-prog-body'. (line-ref): Changed the way the number is obtained. * src/guile/skribilo/engine/latex.scm (line-ref): Removed. * src/guile/skribilo/engine/lout.scm (line-ref): Removed. * src/guile/skribilo/prog.scm (make-line-mark): Removed. (make-prog-body): No longer use it. git-archimport-id: skribilo@sv.gnu.org--2006/skribilo--devo--1.2--patch-133 --- ChangeLog | 35 +++++++++++++++++++++++++++++++++++ src/guile/skribilo/engine/base.scm | 7 ++++--- src/guile/skribilo/engine/context.scm | 16 ---------------- src/guile/skribilo/engine/html.scm | 25 +++++++++++++++++++++---- src/guile/skribilo/engine/latex.scm | 16 ---------------- src/guile/skribilo/engine/lout.scm | 16 ---------------- src/guile/skribilo/prog.scm | 11 ++--------- 7 files changed, 62 insertions(+), 64 deletions(-) diff --git a/ChangeLog b/ChangeLog index 43925d1..ea5d7de 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,41 @@ # arch-tag: automatic-ChangeLog--skribilo@sv.gnu.org--2006/skribilo--devo--1.2 # +2007-07-01 23:50:22 GMT Ludovic Courtes patch-133 + + Summary: + Fixed and simplified `(ref :line ...)', aka. `line-ref'. + Revision: + skribilo--devo--1.2--patch-133 + + * src/guile/skribilo/engine/base.scm (line-ref): Changed the way the + number is obtained. + + * src/guile/skribilo/engine/context.scm (line-ref): Removed. + + * src/guile/skribilo/engine/html.scm (&prog-line): New. Produce an + anchor. Needed because `mark' are no longer produced by + `make-prog-body'. + (line-ref): Changed the way the number is obtained. + + * src/guile/skribilo/engine/latex.scm (line-ref): Removed. + + * src/guile/skribilo/engine/lout.scm (line-ref): Removed. + + * src/guile/skribilo/prog.scm (make-line-mark): Removed. + (make-prog-body): No longer use it. + + modified files: + ChangeLog src/guile/skribilo/engine/base.scm + src/guile/skribilo/engine/context.scm + src/guile/skribilo/engine/html.scm + src/guile/skribilo/engine/latex.scm + src/guile/skribilo/engine/lout.scm src/guile/skribilo/prog.scm + + new patches: + lcourtes@laas.fr--2005-mobile/skribilo--devel--1.2--patch-117 + + 2007-07-01 23:49:58 GMT Ludovic Courtes patch-132 Summary: diff --git a/src/guile/skribilo/engine/base.scm b/src/guile/skribilo/engine/base.scm index 9e9445e..344146e 100644 --- a/src/guile/skribilo/engine/base.scm +++ b/src/guile/skribilo/engine/base.scm @@ -498,7 +498,8 @@ (markup-writer 'line-ref :options '(:offset) :action (lambda (n e) - (let ((o (markup-option n :offset)) - (n (markup-ident (handle-body (markup-body n))))) - (evaluate-document (it (if (integer? o) (+ o n) n)) e)))) + (let ((o (markup-option n :offset)) + (n (markup-option (handle-ast (markup-body n)) :number))) + (if (integer? n) + (display (if (integer? o) (+ o n) n)))))) diff --git a/src/guile/skribilo/engine/context.scm b/src/guile/skribilo/engine/context.scm index 1b4301b..98069a3 100644 --- a/src/guile/skribilo/engine/context.scm +++ b/src/guile/skribilo/engine/context.scm @@ -1060,22 +1060,6 @@ :action (lambda (n e) (context-url (markup-option n :url) (markup-option n :text) e))) -;;//;*---------------------------------------------------------------------*/ -;;//;* line-ref ... */ -;;//;*---------------------------------------------------------------------*/ -;;//(markup-writer 'line-ref -;;// :options '(:offset) -;;// :before "{\\textit{" -;;// :action (lambda (n e) -;;// (let ((o (markup-option n :offset)) -;;// (v (string->number (markup-option n :text)))) -;;// (cond -;;// ((and (number? o) (number? v)) -;;// (display (+ o v))) -;;// (else -;;// (display v))))) -;;// :after "}}") - ;;; ====================================================================== ;;; &the-bibliography ... diff --git a/src/guile/skribilo/engine/html.scm b/src/guile/skribilo/engine/html.scm index 688d33d..a16f01f 100644 --- a/src/guile/skribilo/engine/html.scm +++ b/src/guile/skribilo/engine/html.scm @@ -2069,6 +2069,21 @@ (output (or v (markup-option n :url)) e))) :after "") + +;*---------------------------------------------------------------------*/ +;* &prog-line ... */ +;*---------------------------------------------------------------------*/ +(markup-writer '&prog-line + :before (lambda (n e) + (let ((before (writer-before + (markup-writer-get '&prog-line base-engine)))) + (format #t "") + (before n e))) + :after "\n") + ;*---------------------------------------------------------------------*/ ;* line-ref ... */ ;*---------------------------------------------------------------------*/ @@ -2077,12 +2092,14 @@ :before (html-markup-class "i") :action (lambda (n e) (let ((o (markup-option n :offset)) - (v (string->number (markup-option n :text)))) - (if (and (number? o) (number? v)) - (markup-option-add! n :text (+ o v))) + (v (markup-option (handle-ast (markup-body n)) :number))) + (cond ((and (number? o) (number? v)) + (markup-option-set! n :text (+ o v))) + ((number? v) + (markup-option-set! n :text v))) (output n e (markup-writer-get 'ref e)) (if (and (number? o) (number? v)) - (markup-option-add! n :text v)))) + (markup-option-set! n :text v)))) :after "") ;*---------------------------------------------------------------------*/ diff --git a/src/guile/skribilo/engine/latex.scm b/src/guile/skribilo/engine/latex.scm index 9b49545..8523c9a 100644 --- a/src/guile/skribilo/engine/latex.scm +++ b/src/guile/skribilo/engine/latex.scm @@ -1578,22 +1578,6 @@ (display url) (format #t "}{~a}" url)))))) -;*---------------------------------------------------------------------*/ -;* line-ref ... */ -;*---------------------------------------------------------------------*/ -(markup-writer 'line-ref - :options '(:offset) - :before "{\\textit{" - :action (lambda (n e) - (let ((o (markup-option n :offset)) - (v (string->number (markup-option n :text)))) - (cond - ((and (number? o) (number? v)) - (display (+ o v))) - (else - (display v))))) - :after "}}") - ;*---------------------------------------------------------------------*/ ;* &the-bibliography ... */ ;*---------------------------------------------------------------------*/ diff --git a/src/guile/skribilo/engine/lout.scm b/src/guile/skribilo/engine/lout.scm index 7c273ac..a93cde7 100644 --- a/src/guile/skribilo/engine/lout.scm +++ b/src/guile/skribilo/engine/lout.scm @@ -2471,22 +2471,6 @@ (markup-option-add! n '&transformed #t) (output (transform n) e)))))) -;*---------------------------------------------------------------------*/ -;* line-ref ... */ -;*---------------------------------------------------------------------*/ -(markup-writer 'line-ref - :options '(:offset) - :before "{ @I {" ;; FIXME: Not tested - :action (lambda (n e) - (let ((o (markup-option n :offset)) - (v (string->number (markup-option n :text)))) - (cond - ((and (number? o) (number? v)) - (display (+ o v))) - (else - (display v))))) - :after "} }") - ;*---------------------------------------------------------------------*/ ;* &the-bibliography ... */ ;*---------------------------------------------------------------------*/ diff --git a/src/guile/skribilo/prog.scm b/src/guile/skribilo/prog.scm index 5f08420..87321da 100644 --- a/src/guile/skribilo/prog.scm +++ b/src/guile/skribilo/prog.scm @@ -27,7 +27,6 @@ :use-module (skribilo lib) ;; `new' :use-module (skribilo ast) :use-module (skribilo utils syntax) - :autoload (skribilo package base) (mark) :export (make-prog-body resolve-line)) @@ -52,12 +51,6 @@ ;;; définir en bigloo node-body-set -;*---------------------------------------------------------------------*/ -;* make-line-mark ... */ -;*---------------------------------------------------------------------*/ -(define (make-line-mark ident b) - (list (mark ident) b)) - ;*---------------------------------------------------------------------*/ ;* resolve-line ... */ ;*---------------------------------------------------------------------*/ @@ -200,9 +193,9 @@ (let* ((line-ident (symbol->string (gensym "&prog-line"))) (n (new markup (markup '&prog-line) - (ident line-ident) + (ident (or m line-ident)) (options `((:number ,(and lnum-init lnum)))) - (body (if m (make-line-mark m l) l))))) + (body l)))) (loop (cdr lines) (+ lnum 1) (cons n res)))))))) -- cgit v1.2.3