From 542f6aad4b4455d9a1d6d824cb4377d084c76745 Mon Sep 17 00:00:00 2001
From: Ludovic Courtès
Date: Thu, 20 Nov 2008 23:43:09 +0100
Subject: info: Use `text-table', handle footnotes.

* src/guile/skribilo/engine/info.scm: Use the `text-table' module.
  (document): Properly handle footnotes.
---
 src/guile/skribilo/engine/info.scm | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

(limited to 'src')

diff --git a/src/guile/skribilo/engine/info.scm b/src/guile/skribilo/engine/info.scm
index 27e959a..a1c3b81 100644
--- a/src/guile/skribilo/engine/info.scm
+++ b/src/guile/skribilo/engine/info.scm
@@ -33,6 +33,7 @@
   :autoload   (skribilo output)        (output)
   :autoload   (skribilo debug)         (*debug*)
   :autoload   (skribilo utils justify) (make-justifier)
+  :autoload   (skribilo utils text-table) (table->ascii)
   :use-module (srfi srfi-8)
   :use-module (srfi srfi-13)
 
@@ -155,9 +156,11 @@
 ;*---------------------------------------------------------------------*/
 (markup-writer 'document info-engine
   :action (lambda (doc e)
-            (let ((title  (markup-option doc :title))
-                  (author (markup-option doc :author))
-                  (body   (markup-body doc)))
+            (let ((title     (markup-option doc :title))
+                  (author    (markup-option doc :author))
+                  (body      (markup-body doc))
+                  (footnotes (reverse!
+                              (container-env-get n 'footnote-env))))
               (scribe-document->info doc (if title title "")
                                      (if (list? authors)
                                          authors
@@ -172,15 +175,17 @@
                        (newline)
                        (print "-------------")
                        ;; FIXME: Handle footnotes.
-;;                        (for-each (lambda (fn)
-;;                                    (with-access::%footnote fn (number note id)
-;;                                                            (output (string-append
-;;                                                                     "*"
-;;                                                                     (number->string number)
-;;                                                                     ": "))
-;;                                                            (info note)
-;;                                                            (output-newline)))
-;;                                  footnotes)
+                       (for-each (lambda (fn)
+                                   (let ((label (markup-option fn :label))
+                                         (note  (markup-body fn))
+                                         (id    (markup-ident fn)))
+                                     (output (string-append "*"
+                                                            (number->string number)
+                                                            ": ")
+                                             e)
+                                     (output note e)
+                                     (output-newline)))
+                                 footnotes)
                        )))))))
 
 ;*---------------------------------------------------------------------*/
-- 
cgit v1.2.3