aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès2012-05-26 16:36:56 +0200
committerLudovic Courtès2012-05-27 16:07:56 +0200
commit5c69154f8ef9c10425d26ecb3a2c65f01b76959b (patch)
tree8978ed31c41f0bad02da6e3320534860f2980755
parent4c52b5ab73b57d6d2127901109f3461e6c1e8492 (diff)
downloadskribilo-5c69154f8ef9c10425d26ecb3a2c65f01b76959b.tar.gz
skribilo-5c69154f8ef9c10425d26ecb3a2c65f01b76959b.tar.lz
skribilo-5c69154f8ef9c10425d26ecb3a2c65f01b76959b.zip
info: Add writers for `prog'.
* src/guile/skribilo/engine/info.scm (prog, &prog-line): New markup writers.
-rw-r--r--src/guile/skribilo/engine/info.scm27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/guile/skribilo/engine/info.scm b/src/guile/skribilo/engine/info.scm
index a67288f..d25e584 100644
--- a/src/guile/skribilo/engine/info.scm
+++ b/src/guile/skribilo/engine/info.scm
@@ -760,5 +760,32 @@
(output label e)
(output ")" e))))
+;*---------------------------------------------------------------------*/
+;* info ::%prog ... */
+;*---------------------------------------------------------------------*/
+(markup-writer 'prog info-engine
+ :options '(:line :mark)
+ :action (lambda (n e)
+ ;; Skip a line and indent the program.
+ (newline)
+ (set! *margin* (+ 2 *margin*))
+ (with-justification
+ (make-justifier *text-column-width* 'verbatim)
+ (lambda ()
+ (output (markup-body n) e)))
+ (set! *margin* (- *margin* 2))))
+
+(markup-writer '&prog-line info-engine
+ :action (lambda (n e)
+ ;; Output the program line on a line of its own.
+ (let ((num (markup-option n :number)))
+ (and (number? num)
+ (output-justified (format #f "~3d: " num))))
+ (output (markup-body n) e)
+ (output-flush *margin*)))
+
+;;; Local Variables:
+;;; eval: (put 'markup-writer 'scheme-indent-function 2)
+;;; End:
;;; info.scm ends here