summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Court`es2006-10-12 16:01:47 +0000
committerLudovic Court`es2006-10-12 16:01:47 +0000
commitd70f8ef391dd4a71ad26bbf76c6f33b0f7b47390 (patch)
tree0d167e21c625e043b4e0dc869728189451935b1a
parentf648eb505cd7a63af01f2fdfed4a269014e2f9da (diff)
downloadskribilo-d70f8ef391dd4a71ad26bbf76c6f33b0f7b47390.tar.gz
skribilo-d70f8ef391dd4a71ad26bbf76c6f33b0f7b47390.tar.lz
skribilo-d70f8ef391dd4a71ad26bbf76c6f33b0f7b47390.zip
prog: Fixed line number output (`&prog-line').
* src/guile/skribilo/engine/base.scm: Use `srfi-13'. (&prog-line): Use the `:number' markup option rather than the ident as the line number. * src/guile/skribilo/prog.scm: Use `%skribilo-module-reader'. (make-prog-body): Pass the line number as a `:number' markup option in the `&prog-line' markup. git-archimport-id: lcourtes@laas.fr--2005-libre/skribilo--devo--1.2--patch-62
-rw-r--r--src/guile/skribilo/engine/base.scm12
-rw-r--r--src/guile/skribilo/prog.scm10
2 files changed, 17 insertions, 5 deletions
diff --git a/src/guile/skribilo/engine/base.scm b/src/guile/skribilo/engine/base.scm
index 8418e8b..d49b732 100644
--- a/src/guile/skribilo/engine/base.scm
+++ b/src/guile/skribilo/engine/base.scm
@@ -1,6 +1,7 @@
;;; base.scm -- BASE Skribe engine
;;;
;;; Copyright 2003, 2004 Manuel Serrano
+;;; Copyright 2006 Ludovic Courtès <ludovic.courtes@laas.fr>
;;;
;;;
;;; This program is free software; you can redistribute it and/or modify
@@ -18,7 +19,8 @@
;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
;;; USA.
-(define-skribe-module (skribilo engine base))
+(define-skribe-module (skribilo engine base)
+ :use-module (srfi srfi-13))
;*---------------------------------------------------------------------*/
;* base-engine ... */
@@ -457,8 +459,12 @@
;*---------------------------------------------------------------------*/
(markup-writer '&prog-line
:before (lambda (n e)
- (let ((n (markup-ident n)))
- (if n (skribe-eval (it (list n) ": ") e))))
+ (let ((num (markup-option n :number)))
+ (if (number? num)
+ (skribe-eval
+ (it (string-append (string-pad (number->string num) 3)
+ ": "))
+ e))))
:after "\n")
;*---------------------------------------------------------------------*/
diff --git a/src/guile/skribilo/prog.scm b/src/guile/skribilo/prog.scm
index 266d607..2f531cd 100644
--- a/src/guile/skribilo/prog.scm
+++ b/src/guile/skribilo/prog.scm
@@ -24,8 +24,13 @@
:autoload (ice-9 receive) (receive)
:use-module (skribilo lib) ;; `new'
:autoload (skribilo ast) (node? node-body)
+ :use-module (skribilo utils syntax)
+
:export (make-prog-body resolve-line))
+(fluid-set! current-reader %skribilo-module-reader)
+
+
;;; ======================================================================
;;;
;;; COMPATIBILITY
@@ -211,8 +216,9 @@
(extract-mark (car lines) mark regexp)
(let* ((line-ident (symbol->string (gensym "&prog-line")))
(n (new markup
- (markup '&prog-line)
- (ident line-ident)
+ (markup '&prog-line)
+ (ident line-ident)
+ (options `((:number ,lnum)))
(body (if m (make-line-mark m line-ident l) l)))))
(loop (cdr lines)
(+ lnum 1)