summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLudovic Courtes2007-07-01 23:50:22 +0000
committerLudovic Courtes2007-07-01 23:50:22 +0000
commit46122eb2392f848079320e09eda8b747dc9a4177 (patch)
tree728ea377a75932e600c734a9ed985c2c537cc3d6 /src
parent518ed0ad7bdd7b1bb34360d5480c09bcbdffe5cd (diff)
downloadskribilo-46122eb2392f848079320e09eda8b747dc9a4177.tar.gz
skribilo-46122eb2392f848079320e09eda8b747dc9a4177.tar.lz
skribilo-46122eb2392f848079320e09eda8b747dc9a4177.zip
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
Diffstat (limited to 'src')
-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
6 files changed, 27 insertions, 64 deletions
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))))))))