summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog35
-rw-r--r--src/guile/skribilo/engine/base.scm7
-rw-r--r--src/guile/skribilo/engine/context.scm16
-rw-r--r--src/guile/skribilo/engine/html.scm25
-rw-r--r--src/guile/skribilo/engine/latex.scm16
-rw-r--r--src/guile/skribilo/engine/lout.scm16
-rw-r--r--src/guile/skribilo/prog.scm11
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 <ludovic.courtes@laas.fr>	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 <ludovic.courtes@laas.fr>	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 "</a>")
 
+
+;*---------------------------------------------------------------------*/
+;*    &prog-line ...                                                   */
+;*---------------------------------------------------------------------*/
+(markup-writer '&prog-line
+   :before (lambda (n e)
+             (let ((before (writer-before
+                            (markup-writer-get '&prog-line base-engine))))
+               (format #t "<a name=\"~a\""
+                       (string-canonicalize (markup-ident n)))
+               (html-class n)
+               (display ">")
+               (before n e)))
+   :after "</a>\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 "</i>")
 
 ;*---------------------------------------------------------------------*/
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
@@ -1579,22 +1579,6 @@
 			(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 ...                                            */
 ;*---------------------------------------------------------------------*/
 (markup-writer '&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
@@ -2472,22 +2472,6 @@
 		     (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 ...                                            */
 ;*---------------------------------------------------------------------*/
 (markup-writer '&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))
 
@@ -53,12 +52,6 @@
 
 
 ;*---------------------------------------------------------------------*/
-;*    make-line-mark ...                                               */
-;*---------------------------------------------------------------------*/
-(define (make-line-mark ident b)
-  (list (mark ident) b))
-
-;*---------------------------------------------------------------------*/
 ;*    resolve-line ...                                                 */
 ;*---------------------------------------------------------------------*/
 (define (resolve-line doc id)
@@ -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))))))))